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
59632639
Commit
59632639
authored
Aug 19, 2016
by
Phil Hughes
Committed by
Bryce
Aug 23, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed enter key in search input not working
Closes #20627
parent
f633f7db
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
10 deletions
+28
-10
app/assets/javascripts/gl_dropdown.js
app/assets/javascripts/gl_dropdown.js
+18
-10
spec/features/search_spec.rb
spec/features/search_spec.rb
+10
-0
No files found.
app/assets/javascripts/gl_dropdown.js
View file @
59632639
...
...
@@ -31,8 +31,8 @@
this
.
input
.
on
(
'
keydown
'
,
function
(
e
)
{
var
keyCode
=
e
.
which
;
if
(
keyCode
===
13
)
{
e
.
preventDefault
()
;
if
(
keyCode
===
13
&&
!
options
.
elIsInput
)
{
e
.
preventDefault
()
}
})
.
on
(
'
keyup
'
,
function
(
e
)
{
...
...
@@ -46,7 +46,7 @@
}
else
if
(
this
.
input
.
val
()
===
""
&&
$inputContainer
.
hasClass
(
HAS_VALUE_CLASS
))
{
$inputContainer
.
removeClass
(
HAS_VALUE_CLASS
);
}
if
(
keyCode
===
13
)
{
if
(
keyCode
===
13
&&
!
options
.
elIsInput
)
{
return
false
;
}
if
(
this
.
options
.
remote
)
{
...
...
@@ -238,6 +238,7 @@
}
if
(
this
.
options
.
filterable
)
{
this
.
filter
=
new
GitLabDropdownFilter
(
this
.
filterInput
,
{
elIsInput
:
$
(
this
.
el
).
is
(
'
input
'
),
filterInputBlur
:
this
.
filterInputBlur
,
filterByText
:
this
.
options
.
filterByText
,
onFilter
:
this
.
options
.
onFilter
,
...
...
@@ -266,8 +267,12 @@
if
(
_this
.
dropdown
.
find
(
'
.dropdown-toggle-page
'
).
length
)
{
selector
=
"
.dropdown-page-one
"
+
selector
;
}
if
(
$
(
_this
.
el
).
is
(
'
input
'
))
{
currentIndex
=
-
1
;
}
else
{
$
(
selector
,
_this
.
dropdown
).
first
().
find
(
'
a
'
).
addClass
(
'
is-focused
'
);
return
currentIndex
=
0
;
currentIndex
=
0
;
}
}
};
})(
this
)
...
...
@@ -611,17 +616,20 @@
return
this
.
dropdown
.
before
(
$input
);
};
GitLabDropdown
.
prototype
.
selectRowAtIndex
=
function
(
index
)
{
GitLabDropdown
.
prototype
.
selectRowAtIndex
=
function
()
{
var
$el
,
selector
;
selector
=
SELECTABLE_CLASSES
+
"
:eq(
"
+
index
+
"
) a
"
;
selector
=
"
.dropdown-content .is-focused
"
;
if
(
this
.
dropdown
.
find
(
"
.dropdown-toggle-page
"
).
length
)
{
selector
=
"
.dropdown-page-one
"
+
selector
;
}
$el
=
$
(
selector
,
this
.
dropdown
);
if
(
$el
.
length
)
{
$el
.
first
().
trigger
(
'
click
'
);
var
href
=
$el
.
attr
(
'
href
'
);
if
(
href
&&
href
!==
'
#
'
)
Turbolinks
.
visit
(
href
);
if
(
href
&&
href
!==
'
#
'
)
{
Turbolinks
.
visit
(
href
);
}
else
{
$el
.
first
().
trigger
(
'
click
'
);
}
}
};
...
...
@@ -657,7 +665,7 @@
return
false
;
}
if
(
currentKeyCode
===
13
&&
currentIndex
!==
-
1
)
{
return
_this
.
selectRowAtIndex
(
currentIndex
);
_this
.
selectRowAtIndex
(
);
}
};
})(
this
));
...
...
spec/features/search_spec.rb
View file @
59632639
...
...
@@ -71,6 +71,16 @@ describe "Search", feature: true do
end
describe
'Right header search field'
,
feature:
true
do
it
'allows enter key to search'
,
js:
true
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
fill_in
'search'
,
with:
'gitlab'
find
(
'#search'
).
native
.
send_keys
(
:enter
)
page
.
within
'.title'
do
expect
(
page
).
to
have_content
'Search'
end
end
describe
'Search in project page'
do
before
do
visit
namespace_project_path
(
project
.
namespace
,
project
)
...
...
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