Commit 71953508 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'search_auto' into 'master'

Remove var from search_autocomplete.js

Closes #36272

See merge request gitlab-org/gitlab!20118
parents ab63c876 5ee4bc5d
/* eslint-disable no-return-assign, one-var, no-var, consistent-return, class-methods-use-this, vars-on-top */ /* eslint-disable no-return-assign, consistent-return, class-methods-use-this */
import $ from 'jquery'; import $ from 'jquery';
import { escape, throttle } from 'underscore'; import { escape, throttle } from 'underscore';
...@@ -29,14 +29,14 @@ const KEYCODE = { ...@@ -29,14 +29,14 @@ const KEYCODE = {
}; };
function setSearchOptions() { function setSearchOptions() {
var $projectOptionsDataEl = $('.js-search-project-options'); const $projectOptionsDataEl = $('.js-search-project-options');
var $groupOptionsDataEl = $('.js-search-group-options'); const $groupOptionsDataEl = $('.js-search-group-options');
var $dashboardOptionsDataEl = $('.js-search-dashboard-options'); const $dashboardOptionsDataEl = $('.js-search-dashboard-options');
if ($projectOptionsDataEl.length) { if ($projectOptionsDataEl.length) {
gl.projectOptions = gl.projectOptions || {}; gl.projectOptions = gl.projectOptions || {};
var projectPath = $projectOptionsDataEl.data('projectPath'); const projectPath = $projectOptionsDataEl.data('projectPath');
gl.projectOptions[projectPath] = { gl.projectOptions[projectPath] = {
name: $projectOptionsDataEl.data('name'), name: $projectOptionsDataEl.data('name'),
...@@ -49,7 +49,7 @@ function setSearchOptions() { ...@@ -49,7 +49,7 @@ function setSearchOptions() {
if ($groupOptionsDataEl.length) { if ($groupOptionsDataEl.length) {
gl.groupOptions = gl.groupOptions || {}; gl.groupOptions = gl.groupOptions || {};
var groupPath = $groupOptionsDataEl.data('groupPath'); const groupPath = $groupOptionsDataEl.data('groupPath');
gl.groupOptions[groupPath] = { gl.groupOptions[groupPath] = {
name: $groupOptionsDataEl.data('name'), name: $groupOptionsDataEl.data('name'),
...@@ -387,20 +387,18 @@ export class SearchAutocomplete { ...@@ -387,20 +387,18 @@ export class SearchAutocomplete {
} }
restoreOriginalState() { restoreOriginalState() {
var i, input, inputs, len; const inputs = Object.keys(this.originalState);
inputs = Object.keys(this.originalState); for (let i = 0, len = inputs.length; i < len; i += 1) {
for (i = 0, len = inputs.length; i < len; i += 1) { const input = inputs[i];
input = inputs[i];
this.getElement(`#${input}`).val(this.originalState[input]); this.getElement(`#${input}`).val(this.originalState[input]);
} }
} }
resetSearchState() { resetSearchState() {
var i, input, inputs, len, results; const inputs = Object.keys(this.originalState);
inputs = Object.keys(this.originalState); const results = [];
results = []; for (let i = 0, len = inputs.length; i < len; i += 1) {
for (i = 0, len = inputs.length; i < len; i += 1) { const input = inputs[i];
input = inputs[i];
results.push(this.getElement(`#${input}`).val('')); results.push(this.getElement(`#${input}`).val(''));
} }
return results; return results;
...@@ -415,8 +413,7 @@ export class SearchAutocomplete { ...@@ -415,8 +413,7 @@ export class SearchAutocomplete {
} }
restoreMenu() { restoreMenu() {
var html; const html = `<ul><li class="dropdown-menu-empty-item"><a>${__('Loading...')}</a></li></ul>`;
html = `<ul><li class="dropdown-menu-empty-item"><a>${__('Loading...')}</a></li></ul>`;
return this.dropdownContent.html(html); return this.dropdownContent.html(html);
} }
......
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