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
3beff9e4
Commit
3beff9e4
authored
Jun 21, 2016
by
Alfredo Sumaran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix tooltip title and persist state
parent
10220ef1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
app/assets/javascripts/application.js.coffee
app/assets/javascripts/application.js.coffee
+27
-13
No files found.
app/assets/javascripts/application.js.coffee
View file @
3beff9e4
...
@@ -268,19 +268,33 @@ $ ->
...
@@ -268,19 +268,33 @@ $ ->
.
on
'click'
,
'.js-nav-pin'
,
(
e
)
->
.
on
'click'
,
'.js-nav-pin'
,
(
e
)
->
e
.
preventDefault
()
e
.
preventDefault
()
$pinBtn
=
$
(
e
.
currentTarget
)
$page
=
$
'.page-with-sidebar'
$topNav
=
$
'.navbar-fixed-top'
$tooltip
=
$
"#
#{
$pinBtn
.
attr
(
'aria-describedby'
)
}
"
doPinNav
=
not
$page
.
is
(
'.page-sidebar-pinned'
)
tooltipText
=
'Pin navigation'
$
(
this
).
toggleClass
'is-active'
$
(
this
).
toggleClass
'is-active'
if
$
.
cookie
(
'pin_nav'
)
is
'true'
if
doPinNav
$
.
cookie
'pin_nav'
,
'false'
,
{
path
:
'/'
}
$page
.
addClass
(
'page-sidebar-pinned'
)
$
(
'.page-with-sidebar'
)
$topNav
.
addClass
(
'header-pinned-nav'
)
.
removeClass
(
'page-sidebar-pinned'
)
else
$tooltip
.
remove
()
# Remove it immediately when collapsing the sidebar
$page
.
removeClass
(
'page-sidebar-pinned'
)
.
toggleClass
(
'page-sidebar-collapsed page-sidebar-expanded'
)
.
toggleClass
(
'page-sidebar-collapsed page-sidebar-expanded'
)
$
(
'.navbar-fixed-top'
)
$topNav
.
removeClass
(
'header-pinned-nav'
)
.
removeClass
(
'header-pinned-nav'
)
.
toggleClass
(
'header-collapsed header-expanded'
)
.
toggleClass
(
'header-collapsed header-expanded'
)
$
(
'.pin-nav-btn'
).
attr
(
'data-original-title'
,
'Pin sidebar'
).
tooltip
(
'fixTitle'
).
tooltip
(
'setContent'
)
else
# Save settings
$
.
cookie
'pin_nav'
,
'true'
,
{
path
:
'/'
}
$
.
cookie
'pin_nav'
,
doPinNav
,
{
path
:
'/'
}
$
(
'.page-with-sidebar'
).
addClass
(
'page-sidebar-pinned'
)
$
(
'.navbar-fixed-top'
).
addClass
(
'header-pinned-nav'
)
if
$
.
cookie
(
'pin_nav'
)
is
'true'
or
doPinNav
$
(
'.pin-nav-btn'
).
attr
(
'data-original-title'
,
'Unpin sidebar'
).
tooltip
(
'fixTitle'
).
tooltip
(
'setContent'
)
tooltipText
=
'Unpin navigation'
# Update tooltip text immediately
$tooltip
.
find
(
'.tooltip-inner'
).
text
(
tooltipText
)
# Persist tooltip title
$pinBtn
.
attr
(
'title'
,
tooltipText
).
tooltip
(
'fixTitle'
)
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