summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/search_autocomplete.js.es6
diff options
context:
space:
mode:
authorFatih Acet <acetfatih@gmail.com>2017-01-25 19:27:42 +0000
committerFatih Acet <acetfatih@gmail.com>2017-01-25 19:27:42 +0000
commit767262ac82721b9ac4d80f1cff87188307170ee6 (patch)
tree691a9d8311e7bee381822d69e9e11af5f78cd000 /app/assets/javascripts/search_autocomplete.js.es6
parent637894de8868b05499a275e1685621473addef58 (diff)
parent8010de308eb3fc8da8a1e36c7084d68e7cbf3654 (diff)
downloadgitlab-ce-767262ac82721b9ac4d80f1cff87188307170ee6.tar.gz
Merge branch '25312-search-input-cmd-click-issue' into 'master'
Prevent removal of input that is the parent dropdown element Closes #25312 See merge request !8397
Diffstat (limited to 'app/assets/javascripts/search_autocomplete.js.es6')
-rw-r--r--app/assets/javascripts/search_autocomplete.js.es67
1 files changed, 6 insertions, 1 deletions
diff --git a/app/assets/javascripts/search_autocomplete.js.es6 b/app/assets/javascripts/search_autocomplete.js.es6
index 480755899fb..6250e75d407 100644
--- a/app/assets/javascripts/search_autocomplete.js.es6
+++ b/app/assets/javascripts/search_autocomplete.js.es6
@@ -69,12 +69,17 @@
search: {
fields: ['text']
},
+ id: this.getSearchText,
data: this.getData.bind(this),
selectable: true,
clicked: this.onClick.bind(this)
});
}
+ getSearchText(selectedObject, el) {
+ return selectedObject.id ? selectedObject.text : '';
+ }
+
getData(term, callback) {
var _this, contents, jqXHR;
_this = this;
@@ -364,7 +369,7 @@
onClick(item, $el, e) {
if (location.pathname.indexOf(item.url) !== -1) {
- e.preventDefault();
+ if (!e.metaKey) e.preventDefault();
if (!this.badgePresent) {
if (item.category === 'Projects') {
this.projectInputEl.val(item.id);