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
72538b5f
Commit
72538b5f
authored
Jul 24, 2017
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improvements to positioning of the dropdown
parent
4d2be5bb
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
5 deletions
+22
-5
app/assets/javascripts/fly_out_nav.js
app/assets/javascripts/fly_out_nav.js
+8
-2
app/assets/stylesheets/new_sidebar.scss
app/assets/stylesheets/new_sidebar.scss
+10
-1
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 @
72538b5f
...
@@ -2,7 +2,8 @@ export const calculateTop = (boundingRect, outerHeight) => {
...
@@ -2,7 +2,8 @@ export const calculateTop = (boundingRect, outerHeight) => {
const
windowHeight
=
window
.
innerHeight
;
const
windowHeight
=
window
.
innerHeight
;
const
bottomOverflow
=
windowHeight
-
(
boundingRect
.
top
+
outerHeight
);
const
bottomOverflow
=
windowHeight
-
(
boundingRect
.
top
+
outerHeight
);
return
bottomOverflow
<
0
?
boundingRect
.
top
-
Math
.
abs
(
bottomOverflow
)
:
boundingRect
.
top
;
return
bottomOverflow
<
0
?
(
boundingRect
.
top
-
outerHeight
)
+
boundingRect
.
height
:
boundingRect
.
top
;
};
};
export
default
()
=>
{
export
default
()
=>
{
...
@@ -13,10 +14,15 @@ export default () => {
...
@@ -13,10 +14,15 @@ export default () => {
if
(
$subitems
.
length
)
{
if
(
$subitems
.
length
)
{
const
boundingRect
=
$this
.
getBoundingClientRect
();
const
boundingRect
=
$this
.
getBoundingClientRect
();
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
outerHeight
());
const
top
=
calculateTop
(
boundingRect
,
$subitems
.
outerHeight
());
const
isAbove
=
top
<
boundingRect
.
top
;
$subitems
.
css
({
$subitems
.
css
({
transform
:
`translate3d(0,
${
top
}
px, 0)`
,
transform
:
`translate3d(0,
${
top
}
px, 0)`
,
});
});
if
(
isAbove
)
{
$subitems
.
addClass
(
'
is-above
'
);
}
}
}
}).
on
(
'
mouseout
'
,
e
=>
$
(
'
.sidebar-sub-level-items
'
,
e
.
currentTarget
).
hide
());
}).
on
(
'
mouseout
'
,
e
=>
$
(
'
.sidebar-sub-level-items
'
,
e
.
currentTarget
).
hide
()
.
removeClass
(
'
is-above
'
)
);
};
};
app/assets/stylesheets/new_sidebar.scss
View file @
72538b5f
...
@@ -215,9 +215,18 @@ $new-sidebar-width: 220px;
...
@@ -215,9 +215,18 @@ $new-sidebar-width: 220px;
position
:
absolute
;
position
:
absolute
;
top
:
44px
;
top
:
44px
;
left
:
-30px
;
left
:
-30px
;
right
:
0
;
bottom
:
0
;
bottom
:
0
;
height
:
100%
;
max-height
:
150px
;
width
:
300px
;
z-index
:
-1
;
z-index
:
-1
;
transform
:
skew
(
33deg
);
}
&.
is-above
:
:
after
{
top
:
auto
;
bottom
:
44px
;
transform
:
skew
(
-30deg
);
}
}
a
{
a
{
...
...
spec/javascripts/fly_out_nav_spec.js
View file @
72538b5f
...
@@ -5,6 +5,7 @@ describe('Fly out sidebar navigation', () => {
...
@@ -5,6 +5,7 @@ describe('Fly out sidebar navigation', () => {
it
(
'
returns boundingRect top
'
,
()
=>
{
it
(
'
returns boundingRect top
'
,
()
=>
{
const
boundingRect
=
{
const
boundingRect
=
{
top
:
100
,
top
:
100
,
height
:
100
,
};
};
expect
(
expect
(
...
@@ -14,12 +15,13 @@ describe('Fly out sidebar navigation', () => {
...
@@ -14,12 +15,13 @@ describe('Fly out sidebar navigation', () => {
it
(
'
returns boundingRect - bottomOverflow
'
,
()
=>
{
it
(
'
returns boundingRect - bottomOverflow
'
,
()
=>
{
const
boundingRect
=
{
const
boundingRect
=
{
top
:
window
.
innerHeight
,
top
:
window
.
innerHeight
-
50
,
height
:
100
,
};
};
expect
(
expect
(
calculateTop
(
boundingRect
,
100
),
calculateTop
(
boundingRect
,
100
),
).
toBe
(
window
.
innerHeight
-
10
0
);
).
toBe
(
window
.
innerHeight
-
5
0
);
});
});
});
});
});
});
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