Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kazuhiko Shiozaki
gitlab-ce
Commits
8c1b83cf
Commit
8c1b83cf
authored
Sep 06, 2012
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1391 from NARKOZ/refactoring
Refactoring
parents
e4447de2
66684d6d
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
174 additions
and
201 deletions
+174
-201
app/assets/javascripts/admin.js
app/assets/javascripts/admin.js
+0
-11
app/assets/javascripts/admin.js.coffee
app/assets/javascripts/admin.js.coffee
+8
-0
app/assets/javascripts/application.js
app/assets/javascripts/application.js
+0
-131
app/assets/javascripts/graph.js
app/assets/javascripts/graph.js
+0
-10
app/assets/javascripts/graph.js.coffee
app/assets/javascripts/graph.js.coffee
+10
-0
app/assets/javascripts/loader.js
app/assets/javascripts/loader.js
+0
-11
app/assets/javascripts/loader.js.coffee
app/assets/javascripts/loader.js.coffee
+5
-0
app/assets/javascripts/main.js
app/assets/javascripts/main.js
+130
-0
app/assets/javascripts/projects.js.coffee
app/assets/javascripts/projects.js.coffee
+12
-13
app/assets/javascripts/snippets.js
app/assets/javascripts/snippets.js
+0
-9
app/assets/javascripts/snippets.js.coffee
app/assets/javascripts/snippets.js.coffee
+6
-0
app/assets/javascripts/team.js
app/assets/javascripts/team.js
+0
-8
app/controllers/commits_controller.rb
app/controllers/commits_controller.rb
+3
-8
No files found.
app/assets/javascripts/admin.js
deleted
100644 → 0
View file @
e4447de2
$
(
document
).
ready
(
function
(){
$
(
'
input#user_force_random_password
'
).
on
(
'
change
'
,
function
(
elem
)
{
var
elems
=
$
(
'
#user_password, #user_password_confirmation
'
);
if
(
$
(
this
).
attr
(
'
checked
'
))
{
elems
.
val
(
''
).
attr
(
'
disabled
'
,
true
);
}
else
{
elems
.
removeAttr
(
'
disabled
'
);
}
});
});
app/assets/javascripts/admin.js.coffee
0 → 100644
View file @
8c1b83cf
$
->
$
(
'input#user_force_random_password'
).
on
'change'
,
(
elem
)
->
elems
=
$
(
'#user_password, #user_password_confirmation'
)
if
$
(
@
).
attr
'checked'
elems
.
val
(
''
).
attr
'disabled'
,
true
else
elems
.
removeAttr
'disabled'
app/assets/javascripts/application.js
View file @
8c1b83cf
...
@@ -17,134 +17,3 @@
...
@@ -17,134 +17,3 @@
//= require raphael
//= require raphael
//= require branch-graph
//= require branch-graph
//= require_tree .
//= require_tree .
$
(
document
).
ready
(
function
(){
$
(
"
.one_click_select
"
).
live
(
"
click
"
,
function
(){
$
(
this
).
select
();
});
$
(
'
body
'
).
on
(
'
ajax:complete, ajax:beforeSend, submit
'
,
'
form
'
,
function
(
e
){
var
buttons
=
$
(
'
[type="submit"]
'
,
this
);
switch
(
e
.
type
){
case
'
ajax:beforeSend
'
:
case
'
submit
'
:
buttons
.
attr
(
'
disabled
'
,
'
disabled
'
);
break
;
case
'
ajax:complete
'
:
default
:
buttons
.
removeAttr
(
'
disabled
'
);
break
;
}
})
$
(
"
.account-box
"
).
mouseenter
(
showMenu
);
$
(
"
.account-box
"
).
mouseleave
(
resetMenu
);
$
(
"
#projects-list .project
"
).
live
(
'
click
'
,
function
(
e
){
if
(
e
.
target
.
nodeName
!=
"
A
"
&&
e
.
target
.
nodeName
!=
"
INPUT
"
)
{
location
.
href
=
$
(
this
).
attr
(
"
url
"
);
e
.
stopPropagation
();
return
false
;
}
});
/**
* Focus search field by pressing 's' key
*/
$
(
document
).
keypress
(
function
(
e
)
{
if
(
$
(
e
.
target
).
is
(
"
:input
"
)
)
return
;
switch
(
e
.
which
)
{
case
115
:
focusSearch
();
e
.
preventDefault
();
}
});
/**
* Commit show suppressed diff
*
*/
$
(
"
.supp_diff_link
"
).
bind
(
"
click
"
,
function
()
{
showDiff
(
this
);
});
/**
* Note markdown preview
*
*/
$
(
document
).
on
(
'
click
'
,
'
#preview-link
'
,
function
(
e
)
{
$
(
'
#preview-note
'
).
text
(
'
Loading...
'
);
var
previewLinkText
=
(
$
(
this
).
text
()
==
'
Preview
'
?
'
Edit
'
:
'
Preview
'
);
$
(
this
).
text
(
previewLinkText
);
var
note
=
$
(
'
#note_note
'
).
val
();
if
(
note
.
trim
().
length
===
0
)
{
note
=
'
Nothing to preview
'
;
}
$
.
post
(
$
(
this
).
attr
(
'
href
'
),
{
note
:
note
},
function
(
data
)
{
$
(
'
#preview-note
'
).
html
(
data
);
});
$
(
'
#preview-note, #note_note
'
).
toggle
();
e
.
preventDefault
();
});
});
function
focusSearch
()
{
$
(
"
#search
"
).
focus
();
}
function
updatePage
(
data
){
$
.
ajax
({
type
:
"
GET
"
,
url
:
location
.
href
,
data
:
data
,
dataType
:
"
script
"
});
}
function
showMenu
()
{
$
(
this
).
toggleClass
(
'
hover
'
);
}
function
resetMenu
()
{
$
(
this
).
removeClass
(
"
hover
"
);
}
function
slugify
(
text
)
{
return
text
.
replace
(
/
[^
-a-zA-Z0-9
]
+/g
,
'
_
'
).
toLowerCase
();
}
function
showDiff
(
link
)
{
$
(
link
).
next
(
'
table
'
).
show
();
$
(
link
).
remove
();
}
(
function
(
$
){
var
_chosen
=
$
.
fn
.
chosen
;
$
.
fn
.
extend
({
chosen
:
function
(
options
)
{
var
default_options
=
{
'
search_contains
'
:
'
true
'
};
$
.
extend
(
default_options
,
options
);
return
_chosen
.
apply
(
this
,
[
default_options
]);
}})
})(
jQuery
);
function
ajaxGet
(
url
)
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
url
,
dataType
:
"
script
"
});
}
/**
* Disable button if text field is empty
*/
function
disableButtonIfEmtpyField
(
field_selector
,
button_selector
)
{
field
=
$
(
field_selector
);
if
(
field
.
val
()
==
""
)
{
field
.
closest
(
"
form
"
).
find
(
button_selector
).
attr
(
"
disabled
"
,
"
disabled
"
).
addClass
(
"
disabled
"
);
}
field
.
on
(
'
keyup
'
,
function
(){
var
field
=
$
(
this
);
var
closest_submit
=
field
.
closest
(
"
form
"
).
find
(
button_selector
);
if
(
field
.
val
()
==
""
)
{
closest_submit
.
attr
(
"
disabled
"
,
"
disabled
"
).
addClass
(
"
disabled
"
);
}
else
{
closest_submit
.
removeAttr
(
"
disabled
"
).
removeClass
(
"
disabled
"
);
}
})
}
app/assets/javascripts/graph.js
deleted
100644 → 0
View file @
e4447de2
function
initGraphNav
()
{
$
(
"
.graph svg
"
).
css
(
"
position
"
,
"
relative
"
);
$
(
"
body
"
).
bind
(
"
keyup
"
,
function
(
e
)
{
if
(
e
.
keyCode
==
37
)
{
// left
$
(
"
.graph svg
"
).
animate
({
left
:
"
+=400
"
});
}
else
if
(
e
.
keyCode
==
39
)
{
// right
$
(
"
.graph svg
"
).
animate
({
left
:
"
-=400
"
});
}
});
}
app/assets/javascripts/graph.js.coffee
0 → 100644
View file @
8c1b83cf
initGraphNav
=
->
$
(
'.graph svg'
).
css
'position'
,
'relative'
$
(
'body'
).
bind
'keyup'
,
(
e
)
->
if
e
.
keyCode
is
37
# left
$
(
'.graph svg'
).
animate
left
:
'+=400'
else
if
e
.
keyCode
is
39
# right
$
(
'.graph svg'
).
animate
left
:
'-=400'
window
.
initGraphNav
=
initGraphNav
app/assets/javascripts/loader.js
deleted
100644 → 0
View file @
e4447de2
var
Loader
=
{
img_src
:
"
/assets/ajax-loader.gif
"
,
html
:
function
(
width
)
{
img
=
$
(
"
<img>
"
);
img
.
attr
(
"
width
"
,
width
);
img
.
attr
(
"
src
"
,
this
.
img_src
);
return
img
;
}
}
app/assets/javascripts/loader.js.coffee
0 → 100644
View file @
8c1b83cf
Loader
=
html
:
(
width
)
->
$
(
'<img>'
).
attr
src
:
'/assets/ajax-loader.gif'
,
width
:
width
window
.
Loader
=
Loader
app/assets/javascripts/main.js
0 → 100644
View file @
8c1b83cf
$
(
document
).
ready
(
function
(){
$
(
"
.one_click_select
"
).
live
(
"
click
"
,
function
(){
$
(
this
).
select
();
});
$
(
'
body
'
).
on
(
'
ajax:complete, ajax:beforeSend, submit
'
,
'
form
'
,
function
(
e
){
var
buttons
=
$
(
'
[type="submit"]
'
,
this
);
switch
(
e
.
type
){
case
'
ajax:beforeSend
'
:
case
'
submit
'
:
buttons
.
attr
(
'
disabled
'
,
'
disabled
'
);
break
;
case
'
ajax:complete
'
:
default
:
buttons
.
removeAttr
(
'
disabled
'
);
break
;
}
})
$
(
"
.account-box
"
).
mouseenter
(
showMenu
);
$
(
"
.account-box
"
).
mouseleave
(
resetMenu
);
$
(
"
#projects-list .project
"
).
live
(
'
click
'
,
function
(
e
){
if
(
e
.
target
.
nodeName
!=
"
A
"
&&
e
.
target
.
nodeName
!=
"
INPUT
"
)
{
location
.
href
=
$
(
this
).
attr
(
"
url
"
);
e
.
stopPropagation
();
return
false
;
}
});
/**
* Focus search field by pressing 's' key
*/
$
(
document
).
keypress
(
function
(
e
)
{
if
(
$
(
e
.
target
).
is
(
"
:input
"
)
)
return
;
switch
(
e
.
which
)
{
case
115
:
focusSearch
();
e
.
preventDefault
();
}
});
/**
* Commit show suppressed diff
*
*/
$
(
"
.supp_diff_link
"
).
bind
(
"
click
"
,
function
()
{
showDiff
(
this
);
});
/**
* Note markdown preview
*
*/
$
(
document
).
on
(
'
click
'
,
'
#preview-link
'
,
function
(
e
)
{
$
(
'
#preview-note
'
).
text
(
'
Loading...
'
);
var
previewLinkText
=
(
$
(
this
).
text
()
==
'
Preview
'
?
'
Edit
'
:
'
Preview
'
);
$
(
this
).
text
(
previewLinkText
);
var
note
=
$
(
'
#note_note
'
).
val
();
if
(
note
.
trim
().
length
===
0
)
{
note
=
'
Nothing to preview
'
;
}
$
.
post
(
$
(
this
).
attr
(
'
href
'
),
{
note
:
note
},
function
(
data
)
{
$
(
'
#preview-note
'
).
html
(
data
);
});
$
(
'
#preview-note, #note_note
'
).
toggle
();
e
.
preventDefault
();
});
});
function
focusSearch
()
{
$
(
"
#search
"
).
focus
();
}
function
updatePage
(
data
){
$
.
ajax
({
type
:
"
GET
"
,
url
:
location
.
href
,
data
:
data
,
dataType
:
"
script
"
});
}
function
showMenu
()
{
$
(
this
).
toggleClass
(
'
hover
'
);
}
function
resetMenu
()
{
$
(
this
).
removeClass
(
"
hover
"
);
}
function
slugify
(
text
)
{
return
text
.
replace
(
/
[^
-a-zA-Z0-9
]
+/g
,
'
_
'
).
toLowerCase
();
}
function
showDiff
(
link
)
{
$
(
link
).
next
(
'
table
'
).
show
();
$
(
link
).
remove
();
}
(
function
(
$
){
var
_chosen
=
$
.
fn
.
chosen
;
$
.
fn
.
extend
({
chosen
:
function
(
options
)
{
var
default_options
=
{
'
search_contains
'
:
'
true
'
};
$
.
extend
(
default_options
,
options
);
return
_chosen
.
apply
(
this
,
[
default_options
]);
}})
})(
jQuery
);
function
ajaxGet
(
url
)
{
$
.
ajax
({
type
:
"
GET
"
,
url
:
url
,
dataType
:
"
script
"
});
}
/**
* Disable button if text field is empty
*/
function
disableButtonIfEmtpyField
(
field_selector
,
button_selector
)
{
field
=
$
(
field_selector
);
if
(
field
.
val
()
==
""
)
{
field
.
closest
(
"
form
"
).
find
(
button_selector
).
attr
(
"
disabled
"
,
"
disabled
"
).
addClass
(
"
disabled
"
);
}
field
.
on
(
'
keyup
'
,
function
(){
var
field
=
$
(
this
);
var
closest_submit
=
field
.
closest
(
"
form
"
).
find
(
button_selector
);
if
(
field
.
val
()
==
""
)
{
closest_submit
.
attr
(
"
disabled
"
,
"
disabled
"
).
addClass
(
"
disabled
"
);
}
else
{
closest_submit
.
removeAttr
(
"
disabled
"
).
removeClass
(
"
disabled
"
);
}
})
}
app/assets/javascripts/projects.js.coffee
View file @
8c1b83cf
window
.
Projects
=
->
window
.
Projects
=
->
$
(
"#project_name"
).
live
"change"
,
->
$
(
'#project_name'
).
on
'change'
,
->
slug
=
slugify
(
$
(
this
).
val
())
slug
=
slugify
$
(
@
).
val
()
$
(
"#project_code"
).
val
(
slug
)
$
(
'#project_code'
).
val
slug
$
(
"#project_path"
).
val
(
slug
)
$
(
".new_project, .edit_project"
).
live
"ajax:before"
,
->
$
(
'.new_project, .edit_project'
).
on
'ajax:before'
,
->
$
(
".project_new_holder, .project_edit_holder"
).
hide
()
$
(
'.project_new_holder, .project_edit_holder'
).
hide
()
$
(
".save-project-loader"
).
show
()
$
(
'.save-project-loader'
).
show
()
$
(
"form #project_default_branch"
).
chosen
()
$
(
'form #project_default_branch'
).
chosen
()
disableButtonIfEmtpyField
"#project_name"
,
".project-submit"
disableButtonIfEmtpyField
'#project_name'
,
'.project-submit'
# Git clone panel switcher
# Git clone panel switcher
$
->
$
->
scope
=
$
(
'.project_clone_holder'
)
scope
=
$
'.project_clone_holder'
if
scope
.
length
>
0
if
scope
.
length
>
0
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
click
->
$
(
'a, button'
,
scope
).
removeClass
(
'active'
)
$
(
'a, button'
,
scope
).
removeClass
'active'
$
(
this
).
addClass
(
'active'
)
$
(
@
).
addClass
'active'
$
(
'#project_clone'
,
scope
).
val
(
$
(
this
).
data
(
'clone'
))
$
(
'#project_clone'
,
scope
).
val
$
(
@
).
data
'clone'
app/assets/javascripts/snippets.js
deleted
100644 → 0
View file @
e4447de2
$
(
document
).
ready
(
function
(){
$
(
"
#snippets-table .snippet
"
).
live
(
'
click
'
,
function
(
e
){
if
(
e
.
target
.
nodeName
!=
"
A
"
&&
e
.
target
.
nodeName
!=
"
INPUT
"
)
{
location
.
href
=
$
(
this
).
attr
(
"
url
"
);
e
.
stopPropagation
();
return
false
;
}
});
});
app/assets/javascripts/snippets.js.coffee
0 → 100644
View file @
8c1b83cf
$
->
$
(
'#snippets-table .snippet'
).
live
'click'
,
(
e
)
->
if
e
.
target
.
nodeName
isnt
'A'
and
e
.
target
.
nodeName
isnt
'INPUT'
location
.
href
=
$
(
@
).
attr
'url'
e
.
stopPropagation
()
false
app/assets/javascripts/team.js
deleted
100644 → 0
View file @
e4447de2
function
backToMembers
(){
$
(
"
#new_team_member
"
).
hide
(
"
slide
"
,
{
direction
:
"
right
"
},
150
,
function
(){
$
(
"
#team-table
"
).
show
(
"
slide
"
,
{
direction
:
"
left
"
},
150
,
function
()
{
$
(
"
#new_team_member
"
).
remove
();
$
(
"
.add_new
"
).
show
();
});
});
}
app/controllers/commits_controller.rb
View file @
8c1b83cf
...
@@ -64,19 +64,14 @@ class CommitsController < ApplicationController
...
@@ -64,19 +64,14 @@ class CommitsController < ApplicationController
@commit
.
to_patch
,
@commit
.
to_patch
,
type:
"text/plain"
,
type:
"text/plain"
,
disposition:
'attachment'
,
disposition:
'attachment'
,
filename:
(
@commit
.
id
.
to_s
+
".patch"
)
filename:
"
#{
@commit
.
id
.
patch
}
"
)
)
end
end
protected
protected
def
load_refs
def
load_refs
if
params
[
:ref
].
blank?
@ref
||=
params
[
:ref
].
presence
||
params
[
:branch
].
presence
||
params
[
:tag
].
presence
@branch
=
params
[
:branch
].
blank?
?
nil
:
params
[
:branch
]
@ref
||=
@ref
||
@project
.
try
(
:default_branch
)
||
'master'
@tag
=
params
[
:tag
].
blank?
?
nil
:
params
[
:tag
]
@ref
=
@branch
||
@tag
||
@project
.
try
(
:default_branch
)
||
'master'
else
@ref
=
params
[
:ref
]
end
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment