summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/pages/search
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2020-10-21 07:08:36 +0000
commit48aff82709769b098321c738f3444b9bdaa694c6 (patch)
treee00c7c43e2d9b603a5a6af576b1685e400410dee /app/assets/javascripts/pages/search
parent879f5329ee916a948223f8f43d77fba4da6cd028 (diff)
downloadgitlab-ce-4d844e2fbf8315eaf3fddb9a0b241a909be3ecbf.tar.gz
Add latest changes from gitlab-org/gitlab@13-5-stable-eev13.5.0-rc42
Diffstat (limited to 'app/assets/javascripts/pages/search')
-rw-r--r--app/assets/javascripts/pages/search/show/index.js4
-rw-r--r--app/assets/javascripts/pages/search/show/search.js16
2 files changed, 18 insertions, 2 deletions
diff --git a/app/assets/javascripts/pages/search/show/index.js b/app/assets/javascripts/pages/search/show/index.js
index 92d01343bd5..721219874cf 100644
--- a/app/assets/javascripts/pages/search/show/index.js
+++ b/app/assets/javascripts/pages/search/show/index.js
@@ -1,7 +1,7 @@
import Search from './search';
-import initStateFilter from '~/search/state_filter';
+import initSearchApp from '~/search';
document.addEventListener('DOMContentLoaded', () => {
- initStateFilter();
+ initSearchApp();
return new Search();
});
diff --git a/app/assets/javascripts/pages/search/show/search.js b/app/assets/javascripts/pages/search/show/search.js
index 6ff74325a5e..2cd333f26e1 100644
--- a/app/assets/javascripts/pages/search/show/search.js
+++ b/app/assets/javascripts/pages/search/show/search.js
@@ -4,6 +4,7 @@ import { deprecatedCreateFlash as Flash } from '~/flash';
import Api from '~/api';
import { __ } from '~/locale';
import Project from '~/pages/projects/project';
+import { visitUrl } from '~/lib/utils/url_utility';
import refreshCounts from './refresh_counts';
import setHighlightClass from './highlight_blob_search_result';
@@ -86,6 +87,10 @@ export default class Search {
$(document)
.off('click', this.searchClear)
.on('click', this.searchClear, this.clearSearchField.bind(this));
+
+ $('a.js-search-clear')
+ .off('click', this.clearSearchFilter)
+ .on('click', this.clearSearchFilter);
}
static submitSearch() {
@@ -108,6 +113,17 @@ export default class Search {
.focus();
}
+ // We need to manually follow the link on the anchors
+ // that have this event bound, as their `click` default
+ // behavior is prevented by the toggle logic.
+ /* eslint-disable-next-line class-methods-use-this */
+ clearSearchFilter(ev) {
+ const $target = $(ev.currentTarget);
+
+ visitUrl($target.href);
+ ev.stopPropagation();
+ }
+
getProjectsData(term) {
return new Promise(resolve => {
if (this.groupId) {