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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
b244317a
Commit
b244317a
authored
Mar 24, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Scrolls the dropdown content down
parent
0e290a84
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
2 deletions
+14
-2
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+14
-2
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
b244317a
...
...
@@ -96,7 +96,7 @@ class GitLabDropdown
LOADING_CLASS
=
"is-loading"
PAGE_TWO_CLASS
=
"is-page-two"
ACTIVE_CLASS
=
"is-active"
CURRENT_INDEX
=
0
CURRENT_INDEX
=
-
1
FILTER_INPUT
=
'.dropdown-input .dropdown-input-field'
...
...
@@ -410,7 +410,7 @@ class GitLabDropdown
if
currentKeyCode
is
40
# Move down
CURRENT_INDEX
+=
1
if
CURRENT_INDEX
<
$listItems
.
length
CURRENT_INDEX
+=
1
if
CURRENT_INDEX
<
(
$listItems
.
length
-
1
)
else
if
currentKeyCode
is
38
# Move up
CURRENT_INDEX
-=
1
if
CURRENT_INDEX
>
0
...
...
@@ -434,6 +434,18 @@ class GitLabDropdown
$listItem
=
$
(
selector
,
@
dropdown
)
$listItem
.
addClass
"is-focused"
# Dropdown content scroll area
$dropdownContent
=
$listItem
.
closest
(
'.dropdown-content'
)
dropdownContentBottom
=
$dropdownContent
.
prop
(
'offsetTop'
)
+
$dropdownContent
.
prop
(
'offsetHeight'
)
# Get the offset bottom of the list item
listItemBottom
=
$listItem
.
prop
(
'offsetTop'
)
+
$listItem
.
prop
(
'offsetHeight'
)
console
.
log
listItemBottom
,
dropdownContentBottom
if
listItemBottom
>
dropdownContentBottom
# Scroll the dropdown content down
$dropdownContent
.
scrollTop
(
listItemBottom
-
dropdownContentBottom
)
$
.
fn
.
glDropdown
=
(
opts
)
->
return
@
.
each
->
if
(
!
$
.
data
@
,
'glDropdown'
)
...
...
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