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
5b19c4e4
Commit
5b19c4e4
authored
Aug 02, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make contextual sidebar collapsible
parent
8dfb9874
Changes
8
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
159 additions
and
2 deletions
+159
-2
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+1
-0
app/assets/javascripts/new_sidebar.js
app/assets/javascripts/new_sidebar.js
+40
-0
app/assets/stylesheets/new_sidebar.scss
app/assets/stylesheets/new_sidebar.scss
+106
-2
app/views/layouts/nav/_new_admin_sidebar.html.haml
app/views/layouts/nav/_new_admin_sidebar.html.haml
+2
-0
app/views/layouts/nav/_new_group_sidebar.html.haml
app/views/layouts/nav/_new_group_sidebar.html.haml
+2
-0
app/views/layouts/nav/_new_profile_sidebar.html.haml
app/views/layouts/nav/_new_profile_sidebar.html.haml
+2
-0
app/views/layouts/nav/_new_project_sidebar.html.haml
app/views/layouts/nav/_new_project_sidebar.html.haml
+2
-0
app/views/shared/_sidebar_toggle_button.html.haml
app/views/shared/_sidebar_toggle_button.html.haml
+4
-0
No files found.
app/assets/javascripts/fly_out_nav.js
View file @
5b19c4e4
...
...
@@ -23,6 +23,7 @@ export const showSubLevelItems = (el) => {
const
top
=
calculateTop
(
boundingRect
,
subItems
.
offsetHeight
);
const
isAbove
=
top
<
boundingRect
.
top
;
subItems
.
classList
.
add
(
'
fly-out-list
'
);
subItems
.
style
.
transform
=
`translate3d(0,
${
Math
.
floor
(
top
)}
px, 0)`
;
if
(
isAbove
)
{
...
...
app/assets/javascripts/new_sidebar.js
View file @
5b19c4e4
import
Cookies
from
'
js-cookie
'
;
import
_
from
'
underscore
'
;
/* global bp */
import
'
./breakpoints
'
;
export
default
class
NewNavSidebar
{
constructor
()
{
this
.
initDomElements
();
this
.
render
();
}
initDomElements
()
{
this
.
$page
=
$
(
'
.page-with-sidebar
'
);
this
.
$sidebar
=
$
(
'
.nav-sidebar
'
);
this
.
$overlay
=
$
(
'
.mobile-overlay
'
);
this
.
$openSidebar
=
$
(
'
.toggle-mobile-nav
'
);
this
.
$closeSidebar
=
$
(
'
.close-nav-button
'
);
this
.
$sidebarToggle
=
$
(
'
.js-toggle-sidebar
'
);
}
bindEvents
()
{
this
.
$openSidebar
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
true
));
this
.
$closeSidebar
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$overlay
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$sidebarToggle
.
on
(
'
click
'
,
()
=>
{
const
value
=
!
this
.
$sidebar
.
hasClass
(
'
sidebar-icons-only
'
);
this
.
toggleCollapsedSidebar
(
value
);
});
$
(
window
).
on
(
'
resize
'
,
()
=>
_
.
debounce
(
this
.
render
(),
100
));
}
static
setCollapsedCookie
(
value
)
{
if
(
bp
.
getBreakpointSize
()
!==
'
lg
'
)
{
return
;
}
Cookies
.
set
(
'
sidebar_collapsed
'
,
value
,
{
expires
:
365
*
10
});
}
toggleSidebarNav
(
show
)
{
this
.
$sidebar
.
toggleClass
(
'
nav-sidebar-expanded
'
,
show
);
this
.
$overlay
.
toggleClass
(
'
mobile-nav-open
'
,
show
);
this
.
$sidebar
.
removeClass
(
'
sidebar-icons-only
'
);
}
toggleCollapsedSidebar
(
collapsed
)
{
this
.
$sidebar
.
toggleClass
(
'
sidebar-icons-only
'
,
collapsed
);
this
.
$page
.
toggleClass
(
'
page-with-new-sidebar
'
,
!
collapsed
);
this
.
$page
.
toggleClass
(
'
page-with-icon-sidebar
'
,
collapsed
);
NewNavSidebar
.
setCollapsedCookie
(
collapsed
);
}
render
()
{
const
breakpoint
=
bp
.
getBreakpointSize
();
if
(
breakpoint
===
'
sm
'
||
breakpoint
===
'
md
'
)
{
this
.
toggleCollapsedSidebar
(
true
);
}
else
if
(
breakpoint
===
'
lg
'
)
{
const
collapse
=
Cookies
.
get
(
'
sidebar_collapsed
'
)
===
'
true
'
;
this
.
toggleCollapsedSidebar
(
collapse
);
}
}
}
app/assets/stylesheets/new_sidebar.scss
View file @
5b19c4e4
...
...
@@ -12,9 +12,12 @@ $hover-background: $indigo-700;
$hover-color
:
$white-light
;
$inactive-color
:
$gl-text-color-secondary
;
$new-sidebar-width
:
220px
;
$new-sidebar-collapsed-width
:
50px
;
.page-with-new-sidebar
{
@media
(
min-width
:
$screen-sm-min
)
{
padding-left
:
$new-sidebar-collapsed-width
;
@media
(
min-width
:
$screen-lg-min
)
{
padding-left
:
$new-sidebar-width
;
}
...
...
@@ -29,6 +32,12 @@ $new-sidebar-width: 220px;
}
}
.page-with-icon-sidebar
{
@media
(
min-width
:
$screen-sm-min
)
{
padding-left
:
$new-sidebar-collapsed-width
;
}
}
.context-header
{
position
:
relative
;
...
...
@@ -125,6 +134,20 @@ $new-sidebar-width: 220px;
background-color
:
$gray-normal
;
box-shadow
:
inset
-2px
0
0
$border-color
;
// .expand-full-sidebar-button {
// display: none;
// }
&
.sidebar-icons-only
{
width
:
$new-sidebar-collapsed-width
;
.nav-item-name
,
.badge
,
.project-title
{
display
:
none
;
}
}
&
.nav-sidebar-expanded
{
left
:
0
;
}
...
...
@@ -219,6 +242,8 @@ $new-sidebar-width: 220px;
}
.sidebar-top-level-items
{
margin-bottom
:
60px
;
>
li
{
>
a
{
@media
(
min-width
:
$screen-sm-min
)
{
...
...
@@ -240,7 +265,7 @@ $new-sidebar-width: 220px;
@media
(
min-width
:
$screen-sm-min
)
{
position
:
fixed
;
top
:
0
;
left
:
220px
;
left
:
$new-sidebar-width
;
width
:
150px
;
margin-top
:
-1px
;
padding
:
8px
1px
;
...
...
@@ -326,6 +351,85 @@ $new-sidebar-width: 220px;
}
}
// Collapsed nav
.toggle-sidebar-button
{
width
:
$new-sidebar-width
-
2px
;
position
:
fixed
;
bottom
:
0
;
padding
:
16px
;
background-color
:
$gray-normal
;
border-top
:
2px
solid
$border-color
;
color
:
$gl-text-color-secondary
;
display
:
flex
;
align-items
:
center
;
@media
(
max-width
:
$screen-xs-max
)
{
display
:
none
;
}
i
{
font-size
:
20px
;
margin-right
:
8px
;
}
.fa-angle-double-right
{
display
:
none
;
}
&
:hover
{
background-color
:
$border-color
;
color
:
$gl-text-color
;
}
}
.sidebar-icons-only
{
.context-header
{
height
:
60px
;
a
{
padding
:
10px
4px
;
}
}
li
a
{
padding
:
12px
15px
;
}
.sidebar-top-level-items
>
li
{
&
.active
a
{
padding-left
:
12px
;
}
.sidebar-sub-level-items
{
@media
(
min-width
:
$screen-sm-min
)
{
left
:
$new-sidebar-collapsed-width
;
}
&
:not
(
.flyout-list
)
{
display
:
none
;
}
}
}
.toggle-sidebar-button
{
width
:
$new-sidebar-collapsed-width
-
2px
;
.collapse-text
,
.fa-angle-double-left
{
display
:
none
;
}
.fa-angle-double-right
{
display
:
block
;
}
}
}
// Mobile nav
.toggle-mobile-nav
{
display
:
none
;
background-color
:
transparent
;
...
...
app/views/layouts/nav/_new_admin_sidebar.html.haml
View file @
5b19c4e4
...
...
@@ -174,3 +174,5 @@
=
custom_icon
(
'settings'
)
%span
.nav-item-name
Settings
=
render
'shared/sidebar_toggle_button'
app/views/layouts/nav/_new_group_sidebar.html.haml
View file @
5b19c4e4
...
...
@@ -96,3 +96,5 @@
CI / CD
=
render
"groups/ee/settings_nav"
=
render
'shared/sidebar_toggle_button'
app/views/layouts/nav/_new_profile_sidebar.html.haml
View file @
5b19c4e4
...
...
@@ -88,3 +88,5 @@
=
custom_icon
(
'authentication_log'
)
%span
.nav-item-name
Authentication log
=
render
'shared/sidebar_toggle_button'
app/views/layouts/nav/_new_project_sidebar.html.haml
View file @
5b19c4e4
...
...
@@ -222,6 +222,8 @@
%span
Members
=
render
'shared/sidebar_toggle_button'
-# Shortcut to Project > Activity
%li
.hidden
=
link_to
activity_project_path
(
@project
),
title:
'Activity'
,
class:
'shortcuts-project-activity'
do
...
...
app/views/shared/_sidebar_toggle_button.html.haml
0 → 100644
View file @
5b19c4e4
%a
.toggle-sidebar-button.js-toggle-sidebar
{
role:
"button"
,
type:
"button"
,
title:
"Toggle sidebar"
}
=
icon
(
'angle-double-left'
)
=
icon
(
'angle-double-right'
)
%span
.collapse-text
Collapse sidebar
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