summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2017-01-19 10:37:54 +0000
committerPhil Hughes <me@iamphill.com>2017-01-21 20:05:02 +0000
commit91ad8c3c93ea5f558891e6302b04c378aa79d412 (patch)
treec73ca0a26680878912677eb1b35e92055ad66385
parent658c6c26c384c64e3535e87b5c7bfd550632ff29 (diff)
downloadgitlab-ce-91ad8c3c93ea5f558891e6302b04c378aa79d412.tar.gz
Trigger filter on click
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_manager.js.es615
1 files changed, 11 insertions, 4 deletions
diff --git a/app/assets/javascripts/filtered_search/filtered_search_manager.js.es6 b/app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
index b0cabf9d378..f1912a83e81 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
+++ b/app/assets/javascripts/filtered_search/filtered_search_manager.js.es6
@@ -30,13 +30,14 @@
this.checkForEnterWrapper = this.checkForEnter.bind(this);
this.clearSearchWrapper = this.clearSearch.bind(this);
this.checkForBackspaceWrapper = this.checkForBackspace.bind(this);
- this.showOnClick = this.showOnClick.bind(this);
+ this.tokenChange = this.tokenChange.bind(this);
this.filteredSearchInput.addEventListener('input', this.setDropdownWrapper);
this.filteredSearchInput.addEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.addEventListener('keydown', this.checkForEnterWrapper);
this.filteredSearchInput.addEventListener('keyup', this.checkForBackspaceWrapper);
- this.filteredSearchInput.addEventListener('click', this.showOnClick);
+ this.filteredSearchInput.addEventListener('click', this.tokenChange);
+ this.filteredSearchInput.addEventListener('keyup', this.tokenChange);
this.clearSearchButton.addEventListener('click', this.clearSearchWrapper);
}
@@ -45,7 +46,8 @@
this.filteredSearchInput.removeEventListener('input', this.toggleClearSearchButtonWrapper);
this.filteredSearchInput.removeEventListener('keydown', this.checkForEnterWrapper);
this.filteredSearchInput.removeEventListener('keyup', this.checkForBackspaceWrapper);
- this.filteredSearchInput.removeEventListener('click', this.showOnClick);
+ this.filteredSearchInput.removeEventListener('click', this.tokenChange);
+ this.filteredSearchInput.removeEventListener('keyup', this.tokenChange);
this.clearSearchButton.removeEventListener('click', this.clearSearchWrapper);
}
@@ -192,12 +194,17 @@
return usernamesById;
}
- showOnClick() {
+ tokenChange(e) {
const dropdown = this.dropdownManager.mapping[this.dropdownManager.currentDropdown];
const currentDropdownRef = dropdown.reference;
this.setDropdownWrapper();
currentDropdownRef.dispatchInputEvent();
+
+ if (e.type === 'click') {
+ // If click event, we need to trigger filter
+ this.filteredSearchInput.dispatchEvent(new Event('keyup'));
+ }
}
}