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
Boxiang Sun
gitlab-ce
Commits
3cf9b772
Commit
3cf9b772
authored
Jun 21, 2016
by
Fatih Acet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jQuery selector refactor in application.js.
parent
5804b6a0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
14 deletions
+19
-14
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+19
-14
No files found.
app/assets/javascripts/application.js.coffee
View file @
3cf9b772
...
@@ -121,6 +121,11 @@ window.onload = ->
...
@@ -121,6 +121,11 @@ window.onload = ->
setTimeout
shiftWindow
,
100
setTimeout
shiftWindow
,
100
$
->
$
->
$document
=
$
(
document
)
$window
=
$
(
window
)
$body
=
$
(
'body'
)
gl
.
utils
.
preventDisabledButtons
()
gl
.
utils
.
preventDisabledButtons
()
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
...
@@ -152,7 +157,7 @@ $ ->
...
@@ -152,7 +157,7 @@ $ ->
),
1
),
1
# Initialize tooltips
# Initialize tooltips
$
(
'body'
)
.
tooltip
(
$
body
.
tooltip
(
selector
:
'.has-tooltip, [data-toggle="tooltip"]'
selector
:
'.has-tooltip, [data-toggle="tooltip"]'
placement
:
(
_
,
el
)
->
placement
:
(
_
,
el
)
->
$el
=
$
(
el
)
$el
=
$
(
el
)
...
@@ -171,7 +176,7 @@ $ ->
...
@@ -171,7 +176,7 @@ $ ->
flash
.
show
()
flash
.
show
()
# Disable form buttons while a form is submitting
# Disable form buttons while a form is submitting
$
(
'body'
)
.
on
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
(
e
)
->
$
body
.
on
'ajax:complete, ajax:beforeSend, submit'
,
'form'
,
(
e
)
->
buttons
=
$
(
'[type="submit"]'
,
@
)
buttons
=
$
(
'[type="submit"]'
,
@
)
switch
e
.
type
switch
e
.
type
...
@@ -184,7 +189,7 @@ $ ->
...
@@ -184,7 +189,7 @@ $ ->
$
(
'.account-box'
).
hover
->
$
(
@
).
toggleClass
(
'hover'
)
$
(
'.account-box'
).
hover
->
$
(
@
).
toggleClass
(
'hover'
)
# Commit show suppressed diff
# Commit show suppressed diff
$
(
document
)
.
on
'click'
,
'.diff-content .js-show-suppressed-diff'
,
->
$
document
.
on
'click'
,
'.diff-content .js-show-suppressed-diff'
,
->
$container
=
$
(
@
).
parent
()
$container
=
$
(
@
).
parent
()
$container
.
next
(
'table'
).
show
()
$container
.
next
(
'table'
).
show
()
$container
.
remove
()
$container
.
remove
()
...
@@ -197,13 +202,13 @@ $ ->
...
@@ -197,13 +202,13 @@ $ ->
$
(
'.navbar-toggle i'
).
toggleClass
(
"fa-angle-right fa-angle-left"
)
$
(
'.navbar-toggle i'
).
toggleClass
(
"fa-angle-right fa-angle-left"
)
# Show/hide comments on diff
# Show/hide comments on diff
$
(
"body"
)
.
on
"click"
,
".js-toggle-diff-comments"
,
(
e
)
->
$
body
.
on
"click"
,
".js-toggle-diff-comments"
,
(
e
)
->
$
(
@
).
toggleClass
(
'active'
)
$
(
@
).
toggleClass
(
'active'
)
$
(
@
).
closest
(
".diff-file"
).
find
(
".notes_holder"
).
toggle
()
$
(
@
).
closest
(
".diff-file"
).
find
(
".notes_holder"
).
toggle
()
e
.
preventDefault
()
e
.
preventDefault
()
$
(
document
)
.
off
"click"
,
'.js-confirm-danger'
$
document
.
off
"click"
,
'.js-confirm-danger'
$
(
document
)
.
on
"click"
,
'.js-confirm-danger'
,
(
e
)
->
$
document
.
on
"click"
,
'.js-confirm-danger'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
btn
=
$
(
e
.
target
)
btn
=
$
(
e
.
target
)
text
=
btn
.
data
(
"confirm-danger-message"
)
text
=
btn
.
data
(
"confirm-danger-message"
)
...
@@ -211,7 +216,7 @@ $ ->
...
@@ -211,7 +216,7 @@ $ ->
new
ConfirmDangerModal
(
form
,
text
)
new
ConfirmDangerModal
(
form
,
text
)
$
(
document
)
.
on
'click'
,
'button'
,
->
$
document
.
on
'click'
,
'button'
,
->
$
(
this
).
blur
()
$
(
this
).
blur
()
$
(
'input[type="search"]'
).
each
->
$
(
'input[type="search"]'
).
each
->
...
@@ -219,7 +224,7 @@ $ ->
...
@@ -219,7 +224,7 @@ $ ->
$this
.
attr
'value'
,
$this
.
val
()
$this
.
attr
'value'
,
$this
.
val
()
return
return
$
(
document
)
$
document
.
off
'keyup'
,
'input[type="search"]'
.
off
'keyup'
,
'input[type="search"]'
.
on
'keyup'
,
'input[type="search"]'
,
(
e
)
->
.
on
'keyup'
,
'input[type="search"]'
,
(
e
)
->
$this
=
$
(
this
)
$this
=
$
(
this
)
...
@@ -227,7 +232,7 @@ $ ->
...
@@ -227,7 +232,7 @@ $ ->
$sidebarGutterToggle
=
$
(
'.js-sidebar-toggle'
)
$sidebarGutterToggle
=
$
(
'.js-sidebar-toggle'
)
$
(
document
)
$
document
.
off
'breakpoint:change'
.
off
'breakpoint:change'
.
on
'breakpoint:change'
,
(
e
,
breakpoint
)
->
.
on
'breakpoint:change'
,
(
e
,
breakpoint
)
->
if
breakpoint
is
'sm'
or
breakpoint
is
'xs'
if
breakpoint
is
'sm'
or
breakpoint
is
'xs'
...
@@ -239,14 +244,14 @@ $ ->
...
@@ -239,14 +244,14 @@ $ ->
oldBootstrapBreakpoint
=
bootstrapBreakpoint
oldBootstrapBreakpoint
=
bootstrapBreakpoint
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
if
bootstrapBreakpoint
!=
oldBootstrapBreakpoint
if
bootstrapBreakpoint
!=
oldBootstrapBreakpoint
$
(
document
)
.
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
$
document
.
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
checkInitialSidebarSize
=
->
checkInitialSidebarSize
=
->
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
bootstrapBreakpoint
=
bp
.
getBreakpointSize
()
if
bootstrapBreakpoint
is
"xs"
or
"sm"
if
bootstrapBreakpoint
is
"xs"
or
"sm"
$
(
document
)
.
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
$
document
.
trigger
(
'breakpoint:change'
,
[
bootstrapBreakpoint
])
$
(
window
)
$
window
.
off
"resize.app"
.
off
"resize.app"
.
on
"resize.app"
,
(
e
)
->
.
on
"resize.app"
,
(
e
)
->
fitSidebarForSize
()
fitSidebarForSize
()
...
@@ -256,14 +261,14 @@ $ ->
...
@@ -256,14 +261,14 @@ $ ->
new
Aside
()
new
Aside
()
# Sidenav pinning
# Sidenav pinning
if
$
(
window
)
.
width
()
<
1440
and
$
.
cookie
(
'pin_nav'
)
is
'true'
if
$
window
.
width
()
<
1440
and
$
.
cookie
(
'pin_nav'
)
is
'true'
$
.
cookie
(
'pin_nav'
,
'false'
,
{
path
:
'/'
})
$
.
cookie
(
'pin_nav'
,
'false'
,
{
path
:
'/'
})
$
(
'.page-with-sidebar'
)
$
(
'.page-with-sidebar'
)
.
toggleClass
(
'page-sidebar-collapsed page-sidebar-expanded'
)
.
toggleClass
(
'page-sidebar-collapsed page-sidebar-expanded'
)
.
removeClass
(
'page-sidebar-pinned'
)
.
removeClass
(
'page-sidebar-pinned'
)
$
(
'.navbar-fixed-top'
).
removeClass
(
'header-pinned-nav'
)
$
(
'.navbar-fixed-top'
).
removeClass
(
'header-pinned-nav'
)
$
(
document
)
$
document
.
off
'click'
,
'.js-nav-pin'
.
off
'click'
,
'.js-nav-pin'
.
on
'click'
,
'.js-nav-pin'
,
(
e
)
->
.
on
'click'
,
'.js-nav-pin'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
...
...
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