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
29872c39
Commit
29872c39
authored
Mar 24, 2016
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Enter triggers the currently highlighted element click
parent
858eee9e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
12 deletions
+13
-12
app/assets/javascripts/gl_dropdown.js.coffee
app/assets/javascripts/gl_dropdown.js.coffee
+13
-12
No files found.
app/assets/javascripts/gl_dropdown.js.coffee
View file @
29872c39
...
...
@@ -146,11 +146,11 @@ class GitLabDropdown
data
:
=>
return
@
fullData
callback
:
(
data
)
=>
CURRENT_INDEX
=
-
1
@
parseData
data
@
highlightRow
1
enterCallback
:
=>
if
@
enterCallback
@
select
FirstRow
()
@
select
RowAtIndex
0
# Event listeners
...
...
@@ -380,10 +380,11 @@ class GitLabDropdown
return
selectedObject
selectFirstRow
:
->
selector
=
'.dropdown-content li:first-child a'
selectRowAtIndex
:
(
index
)
->
selector
=
".dropdown-content li:not(.divider):eq(
#{
index
}
) a"
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
selector
=
".dropdown-page-one
.dropdown-content li:first-child a
"
selector
=
".dropdown-page-one
#{
selector
}
"
# simulate a click on the first link
$
(
selector
).
trigger
"click"
...
...
@@ -403,6 +404,7 @@ class GitLabDropdown
e
.
preventDefault
()
e
.
stopPropagation
()
PREV_INDEX
=
CURRENT_INDEX
$listItems
=
$
(
selector
,
@
dropdown
)
if
@
options
.
filterable
...
...
@@ -415,23 +417,22 @@ class GitLabDropdown
# Move up
CURRENT_INDEX
-=
1
if
CURRENT_INDEX
>
0
@
highlightRowAtIndex
(
CURRENT_INDEX
)
@
highlightRowAtIndex
(
$listItems
,
CURRENT_INDEX
)
if
CURRENT_INDEX
isnt
PREV_INDEX
return
false
if
currentKeyCode
is
13
@
selectRowAtIndex
CURRENT_INDEX
removeArrayKeyEvent
:
->
$
(
'body'
).
off
'keydown'
highlightRowAtIndex
:
(
index
,
prevI
ndex
)
->
highlightRowAtIndex
:
(
$listItems
,
i
ndex
)
->
# Remove the class for the previously focused row
$
(
'.is-focused'
,
@
dropdown
).
removeClass
'is-focused'
# Update the class for the row at the specific index
selector
=
".dropdown-content li:not(.divider):eq(
#{
index
}
)"
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
selector
=
".dropdown-page-one
#{
selector
}
"
$listItem
=
$
(
selector
,
@
dropdown
)
$listItem
=
$listItems
.
eq
(
index
)
$listItem
.
addClass
"is-focused"
# Dropdown content scroll area
...
...
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