summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClement Ho <ClemMakesApps@gmail.com>2016-12-12 16:25:31 -0600
committerClement Ho <ClemMakesApps@gmail.com>2017-01-09 16:01:20 -0600
commit6eafd748493e1125e1f5dea698dd3ca6affe15c5 (patch)
tree8c972202038acbeb9ccca714160a8936b359df12
parent16e3fe3f15971bc34c48d65c902ce83a156e350d (diff)
downloadgitlab-ce-6eafd748493e1125e1f5dea698dd3ca6affe15c5.tar.gz
Fix code styling issues
-rw-r--r--app/assets/javascripts/filtered_search/dropdown_hint.js.es62
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es69
-rw-r--r--app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es620
3 files changed, 16 insertions, 15 deletions
diff --git a/app/assets/javascripts/filtered_search/dropdown_hint.js.es6 b/app/assets/javascripts/filtered_search/dropdown_hint.js.es6
index 1aef27163c6..a79779e4977 100644
--- a/app/assets/javascripts/filtered_search/dropdown_hint.js.es6
+++ b/app/assets/javascripts/filtered_search/dropdown_hint.js.es6
@@ -32,7 +32,7 @@
}
itemClicked(e) {
- const selected = e.detail.selected;
+ const { selected } = e.detail;
if (selected.hasAttribute('data-value')) {
this.dismissDropdown();
diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6 b/app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
index a9dbb0f7ccb..130e6bba341 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
+++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown.js.es6
@@ -24,14 +24,15 @@
}
getCurrentHook() {
- return this.droplab.hooks.filter(h => h.id === this.hookId)[0];
+ return this.droplab.hooks.filter(h => h.id === this.hookId)[0] || null;
}
itemClicked(e, getValueFunction) {
- const dataValueSet = this.setDataValueIfSelected(e.detail.selected);
+ const { selected } = e.detail;
+ const dataValueSet = this.setDataValueIfSelected(selected);
if (!dataValueSet) {
- const value = getValueFunction(e.detail.selected);
+ const value = getValueFunction(selected);
gl.FilteredSearchDropdownManager.addWordToInput(value);
}
@@ -67,7 +68,7 @@
this.setAsDropdown();
const currentHook = this.getCurrentHook();
- const firstTimeInitialized = currentHook === undefined;
+ const firstTimeInitialized = currentHook === null;
if (firstTimeInitialized || forceRenderContent) {
this.renderContent(forceShowList);
diff --git a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6 b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
index a0764c275e5..59166840c50 100644
--- a/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
+++ b/app/assets/javascripts/filtered_search/filtered_search_dropdown_manager.js.es6
@@ -55,7 +55,7 @@
}
static addWordToInput(word, addSpace = false) {
- const input = document.querySelector('.filtered-search')
+ const input = document.querySelector('.filtered-search');
const value = input.value;
const hasExistingValue = value.length !== 0;
const { lastToken } = gl.FilteredSearchTokenizer.processTokens(value);
@@ -88,22 +88,22 @@
}
load(key, firstLoad = false) {
- console.log(`🦄 load ${key} dropdown`);
- const glClass = this.mapping[key].gl;
- const element = this.mapping[key].element;
+ const mappingKey = this.mapping[key];
+ const glClass = mappingKey.gl;
+ const element = mappingKey.element;
let forceShowList = false;
- if (!this.mapping[key].reference) {
+ if (!mappingKey.reference) {
const dl = this.droplab;
const defaultArguments = [null, dl, element, this.filteredSearchInput];
- const glArguments = defaultArguments.concat(this.mapping[key].extraArguments || []);
+ const glArguments = defaultArguments.concat(mappingKey.extraArguments || []);
// Passing glArguments to `new gl[glClass](<arguments>)`
- this.mapping[key].reference = new (Function.prototype.bind.apply(gl[glClass], glArguments));
+ mappingKey.reference = new (Function.prototype.bind.apply(gl[glClass], glArguments));
}
if (firstLoad) {
- this.mapping[key].reference.init();
+ mappingKey.reference.init();
}
if (this.currentDropdown === 'hint') {
@@ -112,7 +112,7 @@
}
this.updateDropdownOffset(key);
- this.mapping[key].reference.render(firstLoad, forceShowList);
+ mappingKey.reference.render(firstLoad, forceShowList);
this.currentDropdown = key;
}
@@ -120,7 +120,7 @@
loadDropdown(dropdownName = '') {
let firstLoad = false;
- if(!this.droplab) {
+ if (!this.droplab) {
firstLoad = true;
this.droplab = new DropLab();
}