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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
46921e69
Commit
46921e69
authored
Oct 10, 2012
by
Nihad Abbasov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup main.coffee
parent
b1ef7d7a
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
16 deletions
+16
-16
app/assets/javascripts/main.js.coffee
app/assets/javascripts/main.js.coffee
+16
-16
No files found.
app/assets/javascripts/main.js.coffee
View file @
46921e69
...
...
@@ -7,7 +7,7 @@ window.slugify = (text) ->
window
.
ajaxGet
=
(
url
)
->
$
.
ajax
({
type
:
"GET"
,
url
:
url
,
dataType
:
"script"
})
# Disable button if text field is empty
# Disable button if text field is empty
window
.
disableButtonIfEmptyField
=
(
field_selector
,
button_selector
)
->
field
=
$
(
field_selector
)
closest_submit
=
field
.
closest
(
"form"
).
find
(
button_selector
)
...
...
@@ -15,21 +15,21 @@ window.disableButtonIfEmptyField = (field_selector, button_selector) ->
closest_submit
.
disable
()
if
field
.
val
()
is
""
field
.
on
"keyup"
,
->
if
$
(
this
).
val
()
is
""
if
$
(
@
).
val
()
is
""
closest_submit
.
disable
()
else
closest_submit
.
enable
()
$
->
# Click a .one_click_select field, select the contents
$
(
".one_click_select"
).
live
'click'
,
->
$
(
this
).
select
()
$
(
".one_click_select"
).
on
'click'
,
->
$
(
@
).
select
()
# Initialize chosen selects
$
(
'select.chosen'
).
chosen
()
# Disable form buttons while a form is submitting
$
(
'body'
).
on
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
(
e
)
->
buttons
=
$
(
'[type="submit"]'
,
this
)
buttons
=
$
(
'[type="submit"]'
,
@
)
switch
e
.
type
when
'ajax:beforeSend'
,
'submit'
...
...
@@ -38,7 +38,7 @@ $ ->
buttons
.
enable
()
# Show/Hide the profile menu when hovering the account box
$
(
'.account-box'
).
hover
->
$
(
this
).
toggleClass
(
'hover'
)
$
(
'.account-box'
).
hover
->
$
(
@
).
toggleClass
(
'hover'
)
# Focus search field by pressing 's' key
$
(
document
).
keypress
(
e
)
->
...
...
@@ -52,22 +52,22 @@ $ ->
# Commit show suppressed diff
$
(
".supp_diff_link"
).
bind
"click"
,
->
$
(
this
).
next
(
'table'
).
show
()
$
(
this
).
remove
()
$
(
@
).
next
(
'table'
).
show
()
$
(
@
).
remove
()
# Note markdown preview
$
(
document
).
on
'click'
,
'#preview-link'
,
(
e
)
->
$
(
'#preview-note'
).
text
(
'Loading...'
)
$
(
'#preview-note'
).
text
'Loading...'
previewLinkText
=
if
$
(
this
).
text
()
==
'Preview'
then
'Edit'
else
'Preview'
$
(
this
).
text
(
previewLinkText
)
previewLinkText
=
if
$
(
@
).
text
()
is
'Preview'
then
'Edit'
else
'Preview'
$
(
@
).
text
previewLinkText
note
=
$
(
'#note_note'
).
val
()
if
note
.
trim
().
length
==
0
$
(
'#preview-note'
).
text
(
"Nothing to preview."
)
if
note
.
trim
().
length
is
0
$
(
'#preview-note'
).
text
'Nothing to preview.'
else
$
.
post
$
(
this
).
attr
(
'href'
),
{
note
:
note
},
(
data
)
->
$
.
post
$
(
@
).
attr
(
'href'
),
{
note
:
note
},
(
data
)
->
$
(
'#preview-note'
).
html
(
data
)
$
(
'#preview-note, #note_note'
).
toggle
()
...
...
@@ -79,14 +79,14 @@ $ ->
$
.
fn
.
extend
chosen
:
(
options
)
->
default_options
=
search_contains
:
"true"
$
.
extend
default_options
,
options
_chosen
.
apply
this
,
[
default_options
]
_chosen
.
apply
@
,
[
default_options
]
# Disable an element and add the 'disabled' Bootstrap class
$
.
fn
.
extend
disable
:
->
$
(
this
).
attr
(
'disabled'
,
'disabled'
).
addClass
(
'disabled'
)
$
(
@
).
attr
(
'disabled'
,
'disabled'
).
addClass
(
'disabled'
)
# Enable an element and remove the 'disabled' Bootstrap class
$
.
fn
.
extend
enable
:
->
$
(
this
).
removeAttr
(
'disabled'
).
removeClass
(
'disabled'
)
$
(
@
).
removeAttr
(
'disabled'
).
removeClass
(
'disabled'
)
)(
jQuery
)
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