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
37f0ee04
Commit
37f0ee04
authored
Dec 07, 2017
by
Annabel Dunstone Gray
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Animate contextual sidebar; change class names for easier readability
parent
17542a78
Changes
12
Show whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
51 additions
and
35 deletions
+51
-35
app/assets/javascripts/contextual_sidebar.js
app/assets/javascripts/contextual_sidebar.js
+4
-4
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+1
-1
app/assets/stylesheets/framework/contextual-sidebar.scss
app/assets/stylesheets/framework/contextual-sidebar.scss
+27
-11
app/assets/stylesheets/framework/variables.scss
app/assets/stylesheets/framework/variables.scss
+1
-2
app/assets/stylesheets/pages/boards.scss
app/assets/stylesheets/pages/boards.scss
+3
-3
app/assets/stylesheets/pages/issuable.scss
app/assets/stylesheets/pages/issuable.scss
+1
-1
app/views/layouts/nav/sidebar/_admin.html.haml
app/views/layouts/nav/sidebar/_admin.html.haml
+1
-1
app/views/layouts/nav/sidebar/_group.html.haml
app/views/layouts/nav/sidebar/_group.html.haml
+1
-1
app/views/layouts/nav/sidebar/_profile.html.haml
app/views/layouts/nav/sidebar/_profile.html.haml
+1
-1
app/views/layouts/nav/sidebar/_project.html.haml
app/views/layouts/nav/sidebar/_project.html.haml
+1
-1
app/views/shared/_sidebar_toggle_button.html.haml
app/views/shared/_sidebar_toggle_button.html.haml
+8
-7
spec/javascripts/fly_out_nav_spec.js
spec/javascripts/fly_out_nav_spec.js
+2
-2
No files found.
app/assets/javascripts/contextual_sidebar.js
View file @
37f0ee04
...
@@ -28,7 +28,7 @@ export default class ContextualSidebar {
...
@@ -28,7 +28,7 @@ export default class ContextualSidebar {
this
.
$closeSidebar
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$closeSidebar
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$overlay
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$overlay
.
on
(
'
click
'
,
()
=>
this
.
toggleSidebarNav
(
false
));
this
.
$sidebarToggle
.
on
(
'
click
'
,
()
=>
{
this
.
$sidebarToggle
.
on
(
'
click
'
,
()
=>
{
const
value
=
!
this
.
$sidebar
.
hasClass
(
'
sidebar-
icons-only
'
);
const
value
=
!
this
.
$sidebar
.
hasClass
(
'
sidebar-
collapsed-desktop
'
);
this
.
toggleCollapsedSidebar
(
value
);
this
.
toggleCollapsedSidebar
(
value
);
});
});
...
@@ -43,16 +43,16 @@ export default class ContextualSidebar {
...
@@ -43,16 +43,16 @@ export default class ContextualSidebar {
}
}
toggleSidebarNav
(
show
)
{
toggleSidebarNav
(
show
)
{
this
.
$sidebar
.
toggleClass
(
'
nav-sidebar-expanded
'
,
show
);
this
.
$sidebar
.
toggleClass
(
'
sidebar-expanded-mobile
'
,
show
);
this
.
$overlay
.
toggleClass
(
'
mobile-nav-open
'
,
show
);
this
.
$overlay
.
toggleClass
(
'
mobile-nav-open
'
,
show
);
this
.
$sidebar
.
removeClass
(
'
sidebar-
icons-only
'
);
this
.
$sidebar
.
removeClass
(
'
sidebar-
collapsed-desktop
'
);
}
}
toggleCollapsedSidebar
(
collapsed
)
{
toggleCollapsedSidebar
(
collapsed
)
{
const
breakpoint
=
bp
.
getBreakpointSize
();
const
breakpoint
=
bp
.
getBreakpointSize
();
if
(
this
.
$sidebar
.
length
)
{
if
(
this
.
$sidebar
.
length
)
{
this
.
$sidebar
.
toggleClass
(
'
sidebar-
icons-only
'
,
collapsed
);
this
.
$sidebar
.
toggleClass
(
'
sidebar-
collapsed-desktop
'
,
collapsed
);
this
.
$page
.
toggleClass
(
'
page-with-icon-sidebar
'
,
breakpoint
===
'
sm
'
?
true
:
collapsed
);
this
.
$page
.
toggleClass
(
'
page-with-icon-sidebar
'
,
breakpoint
===
'
sm
'
?
true
:
collapsed
);
}
}
ContextualSidebar
.
setCollapsedCookie
(
collapsed
);
ContextualSidebar
.
setCollapsedCookie
(
collapsed
);
...
...
app/assets/javascripts/fly_out_nav.js
View file @
37f0ee04
...
@@ -21,7 +21,7 @@ let headerHeight = 50;
...
@@ -21,7 +21,7 @@ let headerHeight = 50;
export
const
getHeaderHeight
=
()
=>
headerHeight
;
export
const
getHeaderHeight
=
()
=>
headerHeight
;
export
const
isSidebarCollapsed
=
()
=>
sidebar
&&
sidebar
.
classList
.
contains
(
'
sidebar-
icons-only
'
);
export
const
isSidebarCollapsed
=
()
=>
sidebar
&&
sidebar
.
classList
.
contains
(
'
sidebar-
collapsed-desktop
'
);
export
const
canShowActiveSubItems
=
(
el
)
=>
{
export
const
canShowActiveSubItems
=
(
el
)
=>
{
if
(
el
.
classList
.
contains
(
'
active
'
)
&&
!
isSidebarCollapsed
())
{
if
(
el
.
classList
.
contains
(
'
active
'
)
&&
!
isSidebarCollapsed
())
{
...
...
app/assets/stylesheets/framework/contextual-sidebar.scss
View file @
37f0ee04
.page-with-contextual-sidebar
{
.page-with-contextual-sidebar
{
transition
:
padding-left
,
$sidebar-transition-duration
;
@media
(
min-width
:
$screen-md-min
)
{
@media
(
min-width
:
$screen-md-min
)
{
padding-left
:
$contextual-sidebar-collapsed-width
;
padding-left
:
$contextual-sidebar-collapsed-width
;
}
}
...
@@ -27,8 +29,10 @@
...
@@ -27,8 +29,10 @@
.context-header
{
.context-header
{
position
:
relative
;
position
:
relative
;
margin-right
:
2px
;
margin-right
:
2px
;
width
:
$contextual-sidebar-width
;
a
{
a
{
transition
:
padding
,
$sidebar-transition-duration
;
font-weight
:
$gl-font-weight-bold
;
font-weight
:
$gl-font-weight-bold
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
...
@@ -63,10 +67,10 @@
...
@@ -63,10 +67,10 @@
}
}
.nav-sidebar
{
.nav-sidebar
{
transition
:
width
,
$sidebar-transition-duration
;
position
:
fixed
;
position
:
fixed
;
z-index
:
400
;
z-index
:
400
;
width
:
$contextual-sidebar-width
;
width
:
$contextual-sidebar-width
;
transition
:
left
$sidebar-transition-duration
;
top
:
$header-height
;
top
:
$header-height
;
bottom
:
0
;
bottom
:
0
;
left
:
0
;
left
:
0
;
...
@@ -74,16 +78,15 @@
...
@@ -74,16 +78,15 @@
box-shadow
:
inset
-2px
0
0
$border-color
;
box-shadow
:
inset
-2px
0
0
$border-color
;
transform
:
translate3d
(
0
,
0
,
0
);
transform
:
translate3d
(
0
,
0
,
0
);
&
:not
(
.sidebar-
icons-only
)
{
&
:not
(
.sidebar-
collapsed-desktop
)
{
@media
(
min-width
:
$screen-sm-min
)
and
(
max-width
:
$screen-md-max
)
{
@media
(
min-width
:
$screen-sm-min
)
and
(
max-width
:
$screen-md-max
)
{
box-shadow
:
inset
-2px
0
0
$border-color
,
box-shadow
:
inset
-2px
0
0
$border-color
,
2px
1px
3px
$dropdown-shadow-color
;
2px
1px
3px
$dropdown-shadow-color
;
}
}
}
}
&
.sidebar-icons-only
{
&
.sidebar-collapsed-desktop
{
width
:
auto
;
width
:
$contextual-sidebar-collapsed-width
;
min-width
:
$contextual-sidebar-collapsed-width
;
.nav-sidebar-inner-scroll
{
.nav-sidebar-inner-scroll
{
overflow-x
:
hidden
;
overflow-x
:
hidden
;
...
@@ -108,12 +111,11 @@
...
@@ -108,12 +111,11 @@
}
}
}
}
&
.
nav-sidebar-expanded
{
&
.
sidebar-expanded-mobile
{
left
:
0
;
left
:
0
;
}
}
a
{
a
{
transition
:
none
;
text-decoration
:
none
;
text-decoration
:
none
;
}
}
...
@@ -126,6 +128,7 @@
...
@@ -126,6 +128,7 @@
white-space
:
nowrap
;
white-space
:
nowrap
;
a
{
a
{
transition
:
padding
,
$sidebar-transition-duration
;
display
:
flex
;
display
:
flex
;
align-items
:
center
;
align-items
:
center
;
padding
:
12px
16px
;
padding
:
12px
16px
;
...
@@ -310,11 +313,16 @@
...
@@ -310,11 +313,16 @@
// Collapsed nav
// Collapsed nav
.toggle-sidebar-button
,
.toggle-button-container
{
.close-nav-button
{
width
:
$contextual-sidebar-width
-
2px
;
width
:
$contextual-sidebar-width
-
2px
;
transition
:
width
,
$sidebar-transition-duration
;
position
:
fixed
;
position
:
fixed
;
bottom
:
0
;
bottom
:
0
;
left
:
0
;
}
.toggle-sidebar-button
,
.close-nav-button
{
padding
:
16px
;
padding
:
16px
;
background-color
:
$gray-light
;
background-color
:
$gray-light
;
border
:
0
;
border
:
0
;
...
@@ -343,10 +351,15 @@
...
@@ -343,10 +351,15 @@
}
}
}
}
.collapse-text
{
white-space
:
nowrap
;
overflow
:
hidden
;
}
.sidebar-
icons-only
{
.sidebar-
collapsed-desktop
{
.context-header
{
.context-header
{
height
:
61px
;
height
:
61px
;
width
:
$contextual-sidebar-collapsed-width
;
a
{
a
{
padding
:
10px
4px
;
padding
:
10px
4px
;
...
@@ -373,8 +386,11 @@
...
@@ -373,8 +386,11 @@
margin-right
:
0
;
margin-right
:
0
;
}
}
.toggle-
sidebar-button
{
.toggle-
button-container
{
width
:
$contextual-sidebar-collapsed-width
-
2px
;
width
:
$contextual-sidebar-collapsed-width
-
2px
;
}
.toggle-sidebar-button
{
padding
:
16px
;
padding
:
16px
;
.collapse-text
,
.collapse-text
,
...
...
app/assets/stylesheets/framework/variables.scss
View file @
37f0ee04
...
@@ -5,10 +5,9 @@ $grid-size: 8px;
...
@@ -5,10 +5,9 @@ $grid-size: 8px;
$gutter_collapsed_width
:
62px
;
$gutter_collapsed_width
:
62px
;
$gutter_width
:
290px
;
$gutter_width
:
290px
;
$gutter_inner_width
:
250px
;
$gutter_inner_width
:
250px
;
$sidebar-transition-duration
:
.
15
s
;
$sidebar-transition-duration
:
.
3
s
;
$sidebar-breakpoint
:
1024px
;
$sidebar-breakpoint
:
1024px
;
$default-transition-duration
:
.15s
;
$default-transition-duration
:
.15s
;
$right-sidebar-transition-duration
:
.3s
;
$contextual-sidebar-width
:
220px
;
$contextual-sidebar-width
:
220px
;
$contextual-sidebar-collapsed-width
:
50px
;
$contextual-sidebar-collapsed-width
:
50px
;
...
...
app/assets/stylesheets/pages/boards.scss
View file @
37f0ee04
...
@@ -57,7 +57,7 @@
...
@@ -57,7 +57,7 @@
position
:
relative
;
position
:
relative
;
@media
(
min-width
:
$screen-sm-min
)
{
@media
(
min-width
:
$screen-sm-min
)
{
transition
:
width
$
right-
sidebar-transition-duration
;
transition
:
width
$sidebar-transition-duration
;
width
:
100%
;
width
:
100%
;
&
.is-compact
{
&
.is-compact
{
...
@@ -453,8 +453,8 @@
...
@@ -453,8 +453,8 @@
.right-sidebar.right-sidebar-expanded
{
.right-sidebar.right-sidebar-expanded
{
&
.boards-sidebar-slide-enter-active
,
&
.boards-sidebar-slide-enter-active
,
&
.boards-sidebar-slide-leave-active
{
&
.boards-sidebar-slide-leave-active
{
transition
:
width
$
right-
sidebar-transition-duration
,
transition
:
width
$sidebar-transition-duration
,
padding
$
right-
sidebar-transition-duration
;
padding
$sidebar-transition-duration
;
}
}
&
.boards-sidebar-slide-enter
,
&
.boards-sidebar-slide-enter
,
...
...
app/assets/stylesheets/pages/issuable.scss
View file @
37f0ee04
...
@@ -126,7 +126,7 @@
...
@@ -126,7 +126,7 @@
top
:
$header-height
;
top
:
$header-height
;
bottom
:
0
;
bottom
:
0
;
right
:
0
;
right
:
0
;
transition
:
width
$
right-
sidebar-transition-duration
;
transition
:
width
$sidebar-transition-duration
;
background
:
$gray-light
;
background
:
$gray-light
;
z-index
:
200
;
z-index
:
200
;
overflow
:
hidden
;
overflow
:
hidden
;
...
...
app/views/layouts/nav/sidebar/_admin.html.haml
View file @
37f0ee04
.nav-sidebar
{
class:
(
"sidebar-
icons-only
"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-
collapsed-desktop
"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
.nav-sidebar-inner-scroll
.context-header
.context-header
=
link_to
admin_root_path
,
title:
'Admin Overview'
do
=
link_to
admin_root_path
,
title:
'Admin Overview'
do
...
...
app/views/layouts/nav/sidebar/_group.html.haml
View file @
37f0ee04
-
issues
=
IssuesFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
'opened'
).
execute
-
issues
=
IssuesFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
'opened'
).
execute
-
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
'opened'
,
non_archived:
true
).
execute
-
merge_requests
=
MergeRequestsFinder
.
new
(
current_user
,
group_id:
@group
.
id
,
state:
'opened'
,
non_archived:
true
).
execute
.nav-sidebar
{
class:
(
"sidebar-
icons-only
"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-
collapsed-desktop
"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
.nav-sidebar-inner-scroll
.context-header
.context-header
=
link_to
group_path
(
@group
),
title:
@group
.
name
do
=
link_to
group_path
(
@group
),
title:
@group
.
name
do
...
...
app/views/layouts/nav/sidebar/_profile.html.haml
View file @
37f0ee04
.nav-sidebar
{
class:
(
"sidebar-
icons-only
"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-
collapsed-desktop
"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
.nav-sidebar-inner-scroll
.context-header
.context-header
=
link_to
profile_path
,
title:
'Profile Settings'
do
=
link_to
profile_path
,
title:
'Profile Settings'
do
...
...
app/views/layouts/nav/sidebar/_project.html.haml
View file @
37f0ee04
.nav-sidebar
{
class:
(
"sidebar-
icons-only
"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-
collapsed-desktop
"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
.nav-sidebar-inner-scroll
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
.context-header
.context-header
...
...
app/views/shared/_sidebar_toggle_button.html.haml
View file @
37f0ee04
%a
.toggle-sidebar-button.js-toggle-sidebar
{
role:
"button"
,
type:
"button"
,
title:
"Toggle sidebar"
}
.toggle-button-container
%a
.toggle-sidebar-button.js-toggle-sidebar
{
role:
"button"
,
type:
"button"
,
title:
"Toggle sidebar"
}
=
sprite_icon
(
'angle-double-left'
,
css_class:
'icon-angle-double-left'
)
=
sprite_icon
(
'angle-double-left'
,
css_class:
'icon-angle-double-left'
)
=
sprite_icon
(
'angle-double-right'
,
css_class:
'icon-angle-double-right'
)
=
sprite_icon
(
'angle-double-right'
,
css_class:
'icon-angle-double-right'
)
%span
.collapse-text
Collapse sidebar
.collapse-text
Collapse sidebar
=
button_tag
class:
'close-nav-button'
,
type:
'button'
do
=
button_tag
class:
'close-nav-button'
,
type:
'button'
do
=
sprite_icon
(
'close'
,
size:
16
)
=
sprite_icon
(
'close'
,
size:
16
)
%span
.collapse-text
Close sidebar
.collapse-text
Close sidebar
spec/javascripts/fly_out_nav_spec.js
View file @
37f0ee04
...
@@ -253,7 +253,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -253,7 +253,7 @@ describe('Fly out sidebar navigation', () => {
it
(
'
shows collapsed only sub-items if icon only sidebar
'
,
()
=>
{
it
(
'
shows collapsed only sub-items if icon only sidebar
'
,
()
=>
{
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
const
sidebar
=
document
.
createElement
(
'
div
'
);
const
sidebar
=
document
.
createElement
(
'
div
'
);
sidebar
.
classList
.
add
(
'
sidebar-
icons-only
'
);
sidebar
.
classList
.
add
(
'
sidebar-
collapsed-desktop
'
);
subItems
.
classList
.
add
(
'
is-fly-out-only
'
);
subItems
.
classList
.
add
(
'
is-fly-out-only
'
);
setSidebar
(
sidebar
);
setSidebar
(
sidebar
);
...
@@ -343,7 +343,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -343,7 +343,7 @@ describe('Fly out sidebar navigation', () => {
it
(
'
returns true when active & collapsed sidebar
'
,
()
=>
{
it
(
'
returns true when active & collapsed sidebar
'
,
()
=>
{
const
sidebar
=
document
.
createElement
(
'
div
'
);
const
sidebar
=
document
.
createElement
(
'
div
'
);
sidebar
.
classList
.
add
(
'
sidebar-
icons-only
'
);
sidebar
.
classList
.
add
(
'
sidebar-
collapsed-desktop
'
);
el
.
classList
.
add
(
'
active
'
);
el
.
classList
.
add
(
'
active
'
);
setSidebar
(
sidebar
);
setSidebar
(
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