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
Tatuya Kamada
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
Show 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
...
@@ -146,11 +146,11 @@ class GitLabDropdown
data
:
=>
data
:
=>
return
@
fullData
return
@
fullData
callback
:
(
data
)
=>
callback
:
(
data
)
=>
CURRENT_INDEX
=
-
1
@
parseData
data
@
parseData
data
@
highlightRow
1
enterCallback
:
=>
enterCallback
:
=>
if
@
enterCallback
if
@
enterCallback
@
select
FirstRow
()
@
select
RowAtIndex
0
# Event listeners
# Event listeners
...
@@ -380,10 +380,11 @@ class GitLabDropdown
...
@@ -380,10 +380,11 @@ class GitLabDropdown
return
selectedObject
return
selectedObject
selectFirstRow
:
->
selectRowAtIndex
:
(
index
)
->
selector
=
'.dropdown-content li:first-child a'
selector
=
".dropdown-content li:not(.divider):eq(
#{
index
}
) a"
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
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
# simulate a click on the first link
$
(
selector
).
trigger
"click"
$
(
selector
).
trigger
"click"
...
@@ -403,6 +404,7 @@ class GitLabDropdown
...
@@ -403,6 +404,7 @@ class GitLabDropdown
e
.
preventDefault
()
e
.
preventDefault
()
e
.
stopPropagation
()
e
.
stopPropagation
()
PREV_INDEX
=
CURRENT_INDEX
$listItems
=
$
(
selector
,
@
dropdown
)
$listItems
=
$
(
selector
,
@
dropdown
)
if
@
options
.
filterable
if
@
options
.
filterable
...
@@ -415,23 +417,22 @@ class GitLabDropdown
...
@@ -415,23 +417,22 @@ class GitLabDropdown
# Move up
# Move up
CURRENT_INDEX
-=
1
if
CURRENT_INDEX
>
0
CURRENT_INDEX
-=
1
if
CURRENT_INDEX
>
0
@
highlightRowAtIndex
(
CURRENT_INDEX
)
@
highlightRowAtIndex
(
$listItems
,
CURRENT_INDEX
)
if
CURRENT_INDEX
isnt
PREV_INDEX
return
false
return
false
if
currentKeyCode
is
13
@
selectRowAtIndex
CURRENT_INDEX
removeArrayKeyEvent
:
->
removeArrayKeyEvent
:
->
$
(
'body'
).
off
'keydown'
$
(
'body'
).
off
'keydown'
highlightRowAtIndex
:
(
index
,
prevI
ndex
)
->
highlightRowAtIndex
:
(
$listItems
,
i
ndex
)
->
# Remove the class for the previously focused row
# Remove the class for the previously focused row
$
(
'.is-focused'
,
@
dropdown
).
removeClass
'is-focused'
$
(
'.is-focused'
,
@
dropdown
).
removeClass
'is-focused'
# Update the class for the row at the specific index
# Update the class for the row at the specific index
selector
=
".dropdown-content li:not(.divider):eq(
#{
index
}
)"
$listItem
=
$listItems
.
eq
(
index
)
if
@
dropdown
.
find
(
".dropdown-toggle-page"
).
length
selector
=
".dropdown-page-one
#{
selector
}
"
$listItem
=
$
(
selector
,
@
dropdown
)
$listItem
.
addClass
"is-focused"
$listItem
.
addClass
"is-focused"
# Dropdown content scroll area
# 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