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
1
Merge Requests
1
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
nexedi
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 @@ $ ->
.
on
'click'
,
'.js-nav-pin'
,
(
e
)
->
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'
if
$
.
cookie
(
'pin_nav'
)
is
'true'
$
.
cookie
'pin_nav'
,
'false'
,
{
path
:
'/'
}
$
(
'.page-with-sidebar'
)
.
removeClass
(
'page-sidebar-pinned'
)
if
doPinNav
$page
.
addClass
(
'page-sidebar-pinned'
)
$topNav
.
addClass
(
'header-pinned-nav'
)
else
$tooltip
.
remove
()
# Remove it immediately when collapsing the sidebar
$page
.
removeClass
(
'page-sidebar-pinned'
)
.
toggleClass
(
'page-sidebar-collapsed page-sidebar-expanded'
)
$
(
'.navbar-fixed-top'
)
.
removeClass
(
'header-pinned-nav'
)
$topNav
.
removeClass
(
'header-pinned-nav'
)
.
toggleClass
(
'header-collapsed header-expanded'
)
$
(
'.pin-nav-btn'
).
attr
(
'data-original-title'
,
'Pin sidebar'
).
tooltip
(
'fixTitle'
).
tooltip
(
'setContent'
)
else
$
.
cookie
'pin_nav'
,
'true'
,
{
path
:
'/'
}
$
(
'.page-with-sidebar'
).
addClass
(
'page-sidebar-pinned'
)
$
(
'.navbar-fixed-top'
).
addClass
(
'header-pinned-nav'
)
$
(
'.pin-nav-btn'
).
attr
(
'data-original-title'
,
'Unpin sidebar'
).
tooltip
(
'fixTitle'
).
tooltip
(
'setContent'
)
# Save settings
$
.
cookie
'pin_nav'
,
doPinNav
,
{
path
:
'/'
}
if
$
.
cookie
(
'pin_nav'
)
is
'true'
or
doPinNav
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