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
Léo-Paul Géneau
gitlab-ce
Commits
37382d32
Commit
37382d32
authored
Jan 21, 2017
by
Mike Greiling
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
allow issue filter submission by clicking "Keep typing and press enter"
parent
17f0c99c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
1 deletion
+18
-1
app/assets/javascripts/filtered_search/dropdown_hint.js.es6
app/assets/javascripts/filtered_search/dropdown_hint.js.es6
+3
-0
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
...vascripts/filtered_search/filtered_search_dropdown.js.es6
+6
-0
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
...avascripts/filtered_search/filtered_search_manager.js.es6
+8
-0
app/views/shared/issuable/_search_bar.html.haml
app/views/shared/issuable/_search_bar.html.haml
+1
-1
No files found.
app/assets/javascripts/filtered_search/dropdown_hint.js.es6
View file @
37382d32
...
@@ -20,6 +20,9 @@
...
@@ -20,6 +20,9 @@
if (selected.tagName === 'LI') {
if (selected.tagName === 'LI') {
if (selected.hasAttribute('data-value')) {
if (selected.hasAttribute('data-value')) {
this.dismissDropdown();
this.dismissDropdown();
} else if (selected.getAttribute('data-action') === 'submit') {
this.dismissDropdown();
this.dispatchFormSubmitEvent();
} else {
} else {
const token = selected.querySelector('.js-filter-hint').innerText.trim();
const token = selected.querySelector('.js-filter-hint').innerText.trim();
const tag = selected.querySelector('.js-filter-tag').innerText.trim();
const tag = selected.querySelector('.js-filter-tag').innerText.trim();
...
...
app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
View file @
37382d32
...
@@ -84,6 +84,12 @@
...
@@ -84,6 +84,12 @@
}));
}));
}
}
dispatchFormSubmitEvent() {
// dispatchEvent() is necessary as form.submit() does not
// trigger event handlers
this.input.form.dispatchEvent(new Event('submit'));
}
hideDropdown() {
hideDropdown() {
this.getCurrentHook().list.hide();
this.getCurrentHook().list.hide();
}
}
...
...
app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
View file @
37382d32
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
}
}
bindEvents() {
bindEvents() {
this.handleFormSubmit = this.handleFormSubmit.bind(this);
this.setDropdownWrapper = this.dropdownManager.setDropdown.bind(this.dropdownManager);
this.setDropdownWrapper = this.dropdownManager.setDropdown.bind(this.dropdownManager);
this.toggleClearSearchButtonWrapper = this.toggleClearSearchButton.bind(this);
this.toggleClearSearchButtonWrapper = this.toggleClearSearchButton.bind(this);
this.checkForEnterWrapper = this.checkForEnter.bind(this);
this.checkForEnterWrapper = this.checkForEnter.bind(this);
...
@@ -32,6 +33,7 @@
...
@@ -32,6 +33,7 @@
this.checkForBackspaceWrapper = this.checkForBackspace.bind(this);
this.checkForBackspaceWrapper = this.checkForBackspace.bind(this);
this.tokenChange = this.tokenChange.bind(this);
this.tokenChange = this.tokenChange.bind(this);
this.filteredSearchInput.form.addEventListener('submit', this.handleFormSubmit);
this.filteredSearchInput.addEventListener('input', this.setDropdownWrapper);
this.filteredSearchInput.addEventListener('input', this.setDropdownWrapper);
this.filteredSearchInput.addEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.addEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.addEventListener('keydown', this.checkForEnterWrapper);
this.filteredSearchInput.addEventListener('keydown', this.checkForEnterWrapper);
...
@@ -42,6 +44,7 @@
...
@@ -42,6 +44,7 @@
}
}
unbindEvents() {
unbindEvents() {
this.filteredSearchInput.form.removeEventListener('submit', this.handleFormSubmit);
this.filteredSearchInput.removeEventListener('input', this.setDropdownWrapper);
this.filteredSearchInput.removeEventListener('input', this.setDropdownWrapper);
this.filteredSearchInput.removeEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.removeEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.removeEventListener('keydown', this.checkForEnterWrapper);
this.filteredSearchInput.removeEventListener('keydown', this.checkForEnterWrapper);
...
@@ -88,6 +91,11 @@
...
@@ -88,6 +91,11 @@
this.dropdownManager.resetDropdowns();
this.dropdownManager.resetDropdowns();
}
}
handleFormSubmit(e) {
e.preventDefault();
this.search();
}
loadSearchParamsFromURL() {
loadSearchParamsFromURL() {
const params = gl.utils.getUrlParamsArray();
const params = gl.utils.getUrlParamsArray();
const usernameParams = this.getUsernameParams();
const usernameParams = this.getUsernameParams();
...
...
app/views/shared/issuable/_search_bar.html.haml
View file @
37382d32
...
@@ -17,7 +17,7 @@
...
@@ -17,7 +17,7 @@
=
icon
(
'times'
)
=
icon
(
'times'
)
#js-dropdown-hint
.dropdown-menu.hint-dropdown
#js-dropdown-hint
.dropdown-menu.hint-dropdown
%ul
{
'data-dropdown'
=>
true
}
%ul
{
'data-dropdown'
=>
true
}
%li
.filter-dropdown-item
{
'data-
value'
=>
'
'
}
%li
.filter-dropdown-item
{
'data-
action'
=>
'submit
'
}
%button
.btn.btn-link
%button
.btn.btn-link
=
icon
(
'search'
)
=
icon
(
'search'
)
%span
%span
...
...
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