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
Tatuya Kamada
gitlab-ce
Commits
ee955d7a
Commit
ee955d7a
authored
Jan 30, 2015
by
Jason Blanchard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Adds persistent collapse button for left side bar
parent
c0acb28c
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
86 additions
and
2 deletions
+86
-2
CHANGELOG
CHANGELOG
+1
-0
app/assets/javascripts/sidebar.js.coffee
app/assets/javascripts/sidebar.js.coffee
+10
-0
app/assets/stylesheets/sections/nav_sidebar.scss
app/assets/stylesheets/sections/nav_sidebar.scss
+38
-1
app/helpers/nav_helper.rb
app/helpers/nav_helper.rb
+5
-0
app/views/layouts/_collapse_button.html.haml
app/views/layouts/_collapse_button.html.haml
+4
-0
app/views/layouts/_page.html.haml
app/views/layouts/_page.html.haml
+3
-1
spec/helpers/nav_helper_spec.rb
spec/helpers/nav_helper_spec.rb
+25
-0
No files found.
CHANGELOG
View file @
ee955d7a
...
...
@@ -62,6 +62,7 @@ v 7.8.0
-
-
- Added support for firing system hooks on group create/destroy and adding/removing users to group (Boyan Tabakov)
- Added persistent collapse button for left side nav bar (Jason Blanchard)
v 7.7.2
- Update GitLab Shell to version 2.4.2 that fixes a bug when developers can push to protected branch
...
...
app/assets/javascripts/sidebar.js.coffee
View file @
ee955d7a
...
...
@@ -24,3 +24,13 @@ $ ->
$
(
window
).
resize
->
responsive_resize
()
return
$
(
document
).
on
(
"click"
,
'.toggle-nav-collapse'
,
(
e
)
->
e
.
preventDefault
()
if
$
(
'.page-with-sidebar'
).
hasClass
(
'collapsed'
)
$
(
'.page-with-sidebar'
).
removeClass
(
'collapsed'
)
$
.
cookie
(
"collapsed_nav"
,
"false"
,
{
path
:
'/'
})
else
$
(
'.page-with-sidebar'
).
addClass
(
'collapsed'
)
$
.
cookie
(
"collapsed_nav"
,
"true"
,
{
path
:
'/'
})
)
app/assets/stylesheets/sections/nav_sidebar.scss
View file @
ee955d7a
...
...
@@ -110,7 +110,7 @@
.nav-sidebar
{
margin-top
:
20px
;
position
:
fixed
;
position
:
relative
;
top
:
45px
;
width
:
$sidebar_width
;
}
...
...
@@ -150,6 +150,37 @@
}
}
.collapse-nav
{
position
:
relative
;
top
:
50px
;
width
:
230px
;
text-align
:
right
;
padding-right
:
21px
;
}
.page-with-sidebar.collapsed
{
.collapse-nav
{
width
:
53px
;
}
padding-left
:
50px
;
.sidebar-wrapper
{
width
:
52px
;
overflow-x
:
hidden
;
.nav-sidebar
{
width
:
52px
;
}
.nav-sidebar
li
a
>
span
{
display
:
none
;
}
}
}
@media
(
max-width
:
$screen-md-max
)
{
@include
folded-sidebar
;
}
...
...
@@ -157,3 +188,9 @@
@media
(
min-width
:
$screen-md-max
)
{
@include
expanded-sidebar
;
}
@media
(
max-width
:
$screen-md-max
)
{
.collapse-nav
{
display
:
none
;
}
}
app/helpers/nav_helper.rb
0 → 100644
View file @
ee955d7a
module
NavHelper
def
nav_menu_collapsed?
cookies
[
:collapsed_nav
]
==
'true'
end
end
app/views/layouts/_collapse_button.html.haml
0 → 100644
View file @
ee955d7a
-
if
nav_menu_collapsed?
=
link_to
icon
(
'plus-square'
),
'#'
,
class:
'toggle-nav-collapse'
-
else
=
link_to
icon
(
'minus-square'
),
'#'
,
class:
'toggle-nav-collapse'
app/views/layouts/_page.html.haml
View file @
ee955d7a
-
if
defined?
(
sidebar
)
.page-with-sidebar
.page-with-sidebar
{
:class
=>
(
"collapsed"
if
nav_menu_collapsed?
)}
=
render
"layouts/broadcast"
.sidebar-wrapper
=
render
(
sidebar
)
.collapse-nav
=
render
:partial
=>
'layouts/collapse_button'
.content-wrapper
.container-fluid
.content
...
...
spec/helpers/nav_helper_spec.rb
0 → 100644
View file @
ee955d7a
require
'spec_helper'
# Specs in this file have access to a helper object that includes
# the NavHelper. For example:
#
# describe NavHelper do
# describe "string concat" do
# it "concats two strings with spaces" do
# expect(helper.concat_strings("this","that")).to eq("this that")
# end
# end
# end
describe
NavHelper
do
describe
'#nav_menu_collapsed?'
do
it
'returns true when the nav is collapsed in the cookie'
do
helper
.
request
.
cookies
[
:collapsed_nav
]
=
'true'
expect
(
helper
.
nav_menu_collapsed?
).
to
eq
true
end
it
'returns false when the nav is not collapsed in the cookie'
do
helper
.
request
.
cookies
[
:collapsed_nav
]
=
'false'
expect
(
helper
.
nav_menu_collapsed?
).
to
eq
false
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