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
b5a77392
Commit
b5a77392
authored
Aug 10, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the fly-out menu in the sidebar not displaying in Safari
parent
de0d0e4e
Changes
7
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
548 additions
and
530 deletions
+548
-530
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+7
-1
app/assets/stylesheets/new_sidebar.scss
app/assets/stylesheets/new_sidebar.scss
+7
-1
app/views/layouts/nav/_new_admin_sidebar.html.haml
app/views/layouts/nav/_new_admin_sidebar.html.haml
+136
-135
app/views/layouts/nav/_new_group_sidebar.html.haml
app/views/layouts/nav/_new_group_sidebar.html.haml
+77
-76
app/views/layouts/nav/_new_profile_sidebar.html.haml
app/views/layouts/nav/_new_profile_sidebar.html.haml
+77
-76
app/views/layouts/nav/_new_project_sidebar.html.haml
app/views/layouts/nav/_new_project_sidebar.html.haml
+240
-239
spec/javascripts/fly_out_nav_spec.js
spec/javascripts/fly_out_nav_spec.js
+4
-2
No files found.
app/assets/javascripts/fly_out_nav.js
View file @
b5a77392
...
@@ -15,6 +15,10 @@ export const setOpenMenu = (menu = null) => { currentOpenMenu = menu; };
...
@@ -15,6 +15,10 @@ export const setOpenMenu = (menu = null) => { currentOpenMenu = menu; };
export
const
slope
=
(
a
,
b
)
=>
(
b
.
y
-
a
.
y
)
/
(
b
.
x
-
a
.
x
);
export
const
slope
=
(
a
,
b
)
=>
(
b
.
y
-
a
.
y
)
/
(
b
.
x
-
a
.
x
);
let
headerHeight
=
50
;
export
const
getHeaderHeight
=
()
=>
headerHeight
;
export
const
canShowActiveSubItems
=
(
el
)
=>
{
export
const
canShowActiveSubItems
=
(
el
)
=>
{
const
isHiddenByMedia
=
bp
.
getBreakpointSize
()
===
'
sm
'
||
bp
.
getBreakpointSize
()
===
'
md
'
;
const
isHiddenByMedia
=
bp
.
getBreakpointSize
()
===
'
sm
'
||
bp
.
getBreakpointSize
()
===
'
md
'
;
...
@@ -74,7 +78,7 @@ export const moveSubItemsToPosition = (el, subItems) => {
...
@@ -74,7 +78,7 @@ export const moveSubItemsToPosition = (el, subItems) => {
const
isAbove
=
top
<
boundingRect
.
top
;
const
isAbove
=
top
<
boundingRect
.
top
;
subItems
.
classList
.
add
(
'
fly-out-list
'
);
subItems
.
classList
.
add
(
'
fly-out-list
'
);
subItems
.
style
.
transform
=
`translate3d(0,
${
Math
.
floor
(
top
)}
px, 0)`
;
// eslint-disable-line no-param-reassign
subItems
.
style
.
transform
=
`translate3d(0,
${
Math
.
floor
(
top
)
-
headerHeight
}
px, 0)`
;
// eslint-disable-line no-param-reassign
const
subItemsRect
=
subItems
.
getBoundingClientRect
();
const
subItemsRect
=
subItems
.
getBoundingClientRect
();
...
@@ -153,6 +157,8 @@ export default () => {
...
@@ -153,6 +157,8 @@ export default () => {
},
getHideSubItemsInterval
());
},
getHideSubItemsInterval
());
});
});
headerHeight
=
document
.
querySelector
(
'
.nav-sidebar
'
).
offsetTop
;
items
.
forEach
((
el
)
=>
{
items
.
forEach
((
el
)
=>
{
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
const
subItems
=
el
.
querySelector
(
'
.sidebar-sub-level-items
'
);
...
...
app/assets/stylesheets/new_sidebar.scss
View file @
b5a77392
...
@@ -97,9 +97,9 @@ $new-sidebar-collapsed-width: 50px;
...
@@ -97,9 +97,9 @@ $new-sidebar-collapsed-width: 50px;
top
:
$header-height
;
top
:
$header-height
;
bottom
:
0
;
bottom
:
0
;
left
:
0
;
left
:
0
;
overflow
:
auto
;
background-color
:
$gray-normal
;
background-color
:
$gray-normal
;
box-shadow
:
inset
-2px
0
0
$border-color
;
box-shadow
:
inset
-2px
0
0
$border-color
;
transform
:
translate3d
(
0
,
0
,
0
);
&
.sidebar-icons-only
{
&
.sidebar-icons-only
{
width
:
$new-sidebar-collapsed-width
;
width
:
$new-sidebar-collapsed-width
;
...
@@ -176,6 +176,12 @@ $new-sidebar-collapsed-width: 50px;
...
@@ -176,6 +176,12 @@ $new-sidebar-collapsed-width: 50px;
}
}
}
}
.nav-sidebar-inner-scroll
{
height
:
100%
;
width
:
100%
;
overflow
:
auto
;
}
.with-performance-bar
.nav-sidebar
{
.with-performance-bar
.nav-sidebar
{
top
:
$header-height
+
$performance-bar-height
;
top
:
$header-height
+
$performance-bar-height
;
}
}
...
...
app/views/layouts/nav/_new_admin_sidebar.html.haml
View file @
b5a77392
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.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
.avatar-container.s40.settings-avatar
.avatar-container.s40.settings-avatar
...
...
app/views/layouts/nav/_new_group_sidebar.html.haml
View file @
b5a77392
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.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
.avatar-container.s40.group-avatar
.avatar-container.s40.group-avatar
...
...
app/views/layouts/nav/_new_profile_sidebar.html.haml
View file @
b5a77392
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
.context-header
.context-header
=
link_to
profile_path
,
title:
'Profile Settings'
do
=
link_to
profile_path
,
title:
'Profile Settings'
do
.avatar-container.s40.settings-avatar
.avatar-container.s40.settings-avatar
...
...
app/views/layouts/nav/_new_project_sidebar.html.haml
View file @
b5a77392
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar
{
class:
(
"sidebar-icons-only"
if
collapsed_sidebar?
)
}
.nav-sidebar-inner-scroll
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
-
can_edit
=
can?
(
current_user
,
:admin_project
,
@project
)
.context-header
.context-header
=
link_to
project_path
(
@project
),
title:
@project
.
name
do
=
link_to
project_path
(
@project
),
title:
@project
.
name
do
...
...
spec/javascripts/fly_out_nav_spec.js
View file @
b5a77392
...
@@ -10,6 +10,7 @@ import {
...
@@ -10,6 +10,7 @@ import {
mousePos
,
mousePos
,
getHideSubItemsInterval
,
getHideSubItemsInterval
,
documentMouseMove
,
documentMouseMove
,
getHeaderHeight
,
}
from
'
~/fly_out_nav
'
;
}
from
'
~/fly_out_nav
'
;
import
bp
from
'
~/breakpoints
'
;
import
bp
from
'
~/breakpoints
'
;
...
@@ -59,7 +60,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -59,7 +60,7 @@ describe('Fly out sidebar navigation', () => {
describe
(
'
getHideSubItemsInterval
'
,
()
=>
{
describe
(
'
getHideSubItemsInterval
'
,
()
=>
{
beforeEach
(()
=>
{
beforeEach
(()
=>
{
el
.
innerHTML
=
'
<div class="sidebar-sub-level-items" style="position: fixed; top: 0; left: 100px; height: 50px;"></div>
'
;
el
.
innerHTML
=
'
<div class="sidebar-sub-level-items" style="position: fixed; top: 0; left: 100px; height:
1
50px;"></div>
'
;
});
});
it
(
'
returns 0 if currentOpenMenu is nil
'
,
()
=>
{
it
(
'
returns 0 if currentOpenMenu is nil
'
,
()
=>
{
...
@@ -112,6 +113,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -112,6 +113,7 @@ describe('Fly out sidebar navigation', () => {
clientX
:
el
.
getBoundingClientRect
().
left
+
20
,
clientX
:
el
.
getBoundingClientRect
().
left
+
20
,
clientY
:
el
.
getBoundingClientRect
().
top
+
10
,
clientY
:
el
.
getBoundingClientRect
().
top
+
10
,
});
});
console
.
log
(
el
);
expect
(
expect
(
getHideSubItemsInterval
(),
getHideSubItemsInterval
(),
...
@@ -245,7 +247,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -245,7 +247,7 @@ describe('Fly out sidebar navigation', () => {
expect
(
expect
(
subItems
.
style
.
transform
,
subItems
.
style
.
transform
,
).
toBe
(
`translate3d(0px,
${
Math
.
floor
(
el
.
getBoundingClientRect
().
top
)}
px, 0px)`
);
).
toBe
(
`translate3d(0px,
${
Math
.
floor
(
el
.
getBoundingClientRect
().
top
)
-
getHeaderHeight
()
}
px, 0px)`
);
});
});
it
(
'
sets is-above when element is above
'
,
()
=>
{
it
(
'
sets is-above when element is above
'
,
()
=>
{
...
...
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