Commit 98cb6101 authored by Clement Ho's avatar Clement Ho

Refactor static data to get information from other variables instead

parent e9886b57
......@@ -15,7 +15,7 @@
project_id: this.getProjectId(),
current_user: true,
},
searchValueFunction: this.getSearchInput,
searchValueFunction: this.getSearchInput.bind(this),
loadingTemplate: this.loadingTemplate,
},
};
......@@ -37,7 +37,7 @@
}
getSearchInput() {
const query = document.querySelector('.filtered-search').value;
const query = this.input.value;
const { value } = gl.FilteredSearchTokenizer.getLastTokenObject(query);
const valueWithoutColon = value.slice(1);
const hasPrefix = valueWithoutColon[0] === '@';
......
......@@ -5,7 +5,7 @@
class FilteredSearchDropdown {
constructor(droplab, dropdown, input) {
this.droplab = droplab;
this.hookId = 'filtered-search';
this.hookId = input.getAttribute('data-id');
this.input = input;
this.dropdown = dropdown;
this.loadingTemplate = `<div class="filter-dropdown-loading">
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment