diff options
Diffstat (limited to 'app/assets/javascripts/droplab')
-rw-r--r-- | app/assets/javascripts/droplab/drop_down.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/drop_lab.js | 10 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/hook_button.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/hook_input.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/keyboard.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/plugins/ajax.js | 4 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/plugins/ajax_filter.js | 8 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/plugins/filter.js | 10 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/plugins/input_setter.js | 2 | ||||
-rw-r--r-- | app/assets/javascripts/droplab/utils.js | 7 |
10 files changed, 25 insertions, 30 deletions
diff --git a/app/assets/javascripts/droplab/drop_down.js b/app/assets/javascripts/droplab/drop_down.js index 31d32fb5060..f4a0b3ed727 100644 --- a/app/assets/javascripts/droplab/drop_down.js +++ b/app/assets/javascripts/droplab/drop_down.js @@ -68,7 +68,7 @@ class DropDown { removeSelectedClasses() { const items = this.items || this.getItems(); - items.forEach(item => item.classList.remove(SELECTED_CLASS)); + items.forEach((item) => item.classList.remove(SELECTED_CLASS)); } addEvents() { @@ -162,7 +162,7 @@ class DropDown { static setImagesSrc(template) { const images = [...template.querySelectorAll('img[data-src]')]; - images.forEach(image => { + images.forEach((image) => { const img = image; img.src = img.getAttribute('data-src'); diff --git a/app/assets/javascripts/droplab/drop_lab.js b/app/assets/javascripts/droplab/drop_lab.js index 33c05404493..537a05aebb9 100644 --- a/app/assets/javascripts/droplab/drop_lab.js +++ b/app/assets/javascripts/droplab/drop_lab.js @@ -28,7 +28,7 @@ class DropLab { } destroy() { - this.hooks.forEach(hook => hook.destroy()); + this.hooks.forEach((hook) => hook.destroy()); this.hooks = []; this.removeEvents(); } @@ -51,7 +51,7 @@ class DropLab { } processData(trigger, data, methodName) { - this.hooks.forEach(hook => { + this.hooks.forEach((hook) => { if (Array.isArray(trigger)) hook.list[methodName](trigger); if (hook.trigger.id === trigger) hook.list[methodName](data); @@ -70,7 +70,7 @@ class DropLab { if (utils.isDropDownParts(thisTag, this.hooks)) return; if (utils.isDropDownParts(e.target, this.hooks)) return; - this.hooks.forEach(hook => hook.list.hide()); + this.hooks.forEach((hook) => hook.list.hide()); } removeEvents() { @@ -115,7 +115,7 @@ class DropLab { } addHooks(hooks, plugins, config) { - hooks.forEach(hook => this.addHook(hook, null, plugins, config)); + hooks.forEach((hook) => this.addHook(hook, null, plugins, config)); return this; } @@ -147,7 +147,7 @@ class DropLab { this.fireReady(); - this.queuedData.forEach(data => this.addData(data)); + this.queuedData.forEach((data) => this.addData(data)); this.queuedData = []; return this; diff --git a/app/assets/javascripts/droplab/hook_button.js b/app/assets/javascripts/droplab/hook_button.js index af45eba74e7..c58d0052251 100644 --- a/app/assets/javascripts/droplab/hook_button.js +++ b/app/assets/javascripts/droplab/hook_button.js @@ -14,7 +14,7 @@ class HookButton extends Hook { } addPlugins() { - this.plugins.forEach(plugin => plugin.init(this)); + this.plugins.forEach((plugin) => plugin.init(this)); } clicked(e) { @@ -44,7 +44,7 @@ class HookButton extends Hook { } removePlugins() { - this.plugins.forEach(plugin => plugin.destroy()); + this.plugins.forEach((plugin) => plugin.destroy()); } destroy() { diff --git a/app/assets/javascripts/droplab/hook_input.js b/app/assets/javascripts/droplab/hook_input.js index 19131a64f2c..c523dae347f 100644 --- a/app/assets/javascripts/droplab/hook_input.js +++ b/app/assets/javascripts/droplab/hook_input.js @@ -14,7 +14,7 @@ class HookInput extends Hook { } addPlugins() { - this.plugins.forEach(plugin => plugin.init(this)); + this.plugins.forEach((plugin) => plugin.init(this)); } addEvents() { @@ -101,7 +101,7 @@ class HookInput extends Hook { } removePlugins() { - this.plugins.forEach(plugin => plugin.destroy()); + this.plugins.forEach((plugin) => plugin.destroy()); } destroy() { diff --git a/app/assets/javascripts/droplab/keyboard.js b/app/assets/javascripts/droplab/keyboard.js index 40837ffdf8f..fe1ea2fa6b0 100644 --- a/app/assets/javascripts/droplab/keyboard.js +++ b/app/assets/javascripts/droplab/keyboard.js @@ -2,7 +2,7 @@ import { ACTIVE_CLASS } from './constants'; -const Keyboard = function() { +const Keyboard = function () { var currentKey; var currentFocus; var isUpArrow = false; diff --git a/app/assets/javascripts/droplab/plugins/ajax.js b/app/assets/javascripts/droplab/plugins/ajax.js index 48b2a90c459..77d60454d1a 100644 --- a/app/assets/javascripts/droplab/plugins/ajax.js +++ b/app/assets/javascripts/droplab/plugins/ajax.js @@ -43,10 +43,10 @@ const Ajax = { return AjaxCache.retrieve(config.endpoint) .then(self.preprocessing.bind(null, config)) - .then(data => self._loadData(data, config, self)) + .then((data) => self._loadData(data, config, self)) .catch(config.onError); }, - destroy: function() { + destroy: function () { this.destroyed = true; }, }; diff --git a/app/assets/javascripts/droplab/plugins/ajax_filter.js b/app/assets/javascripts/droplab/plugins/ajax_filter.js index 66a52548417..ac4d44adc17 100644 --- a/app/assets/javascripts/droplab/plugins/ajax_filter.js +++ b/app/assets/javascripts/droplab/plugins/ajax_filter.js @@ -2,7 +2,7 @@ import AjaxCache from '../../lib/utils/ajax_cache'; const AjaxFilter = { - init: function(hook) { + init: function (hook) { this.destroyed = false; this.hook = hook; this.notLoading(); @@ -63,7 +63,7 @@ const AjaxFilter = { params[config.searchKey] = searchValue; var url = config.endpoint + this.buildParams(params); return AjaxCache.retrieve(url) - .then(data => { + .then((data) => { this._loadData(data, config); if (config.onLoadingFinished) { config.onLoadingFinished(data); @@ -93,9 +93,9 @@ const AjaxFilter = { list.currentIndex = 0; }, - buildParams: function(params) { + buildParams: function (params) { if (!params) return ''; - var paramsArray = Object.keys(params).map(function(param) { + var paramsArray = Object.keys(params).map(function (param) { return param + '=' + (params[param] || ''); }); return '?' + paramsArray.join('&'); diff --git a/app/assets/javascripts/droplab/plugins/filter.js b/app/assets/javascripts/droplab/plugins/filter.js index 6f1dc252d24..06391668928 100644 --- a/app/assets/javascripts/droplab/plugins/filter.js +++ b/app/assets/javascripts/droplab/plugins/filter.js @@ -1,7 +1,7 @@ /* eslint-disable */ const Filter = { - keydown: function(e) { + keydown: function (e) { if (this.destroyed) return; var hiddenCount = 0; @@ -21,22 +21,22 @@ const Filter = { if (config && config.filterFunction && typeof config.filterFunction === 'function') { filterFunction = config.filterFunction; } else { - filterFunction = function(o) { + filterFunction = function (o) { // cheap string search o.droplab_hidden = o[config.template].toLowerCase().indexOf(value) === -1; return o; }; } - dataHiddenCount = data.filter(function(o) { + dataHiddenCount = data.filter(function (o) { return !o.droplab_hidden; }).length; - matches = data.map(function(o) { + matches = data.map(function (o) { return filterFunction(o, value); }); - hiddenCount = matches.filter(function(o) { + hiddenCount = matches.filter(function (o) { return !o.droplab_hidden; }).length; diff --git a/app/assets/javascripts/droplab/plugins/input_setter.js b/app/assets/javascripts/droplab/plugins/input_setter.js index 6cfc738a1e3..148d9a35b81 100644 --- a/app/assets/javascripts/droplab/plugins/input_setter.js +++ b/app/assets/javascripts/droplab/plugins/input_setter.js @@ -27,7 +27,7 @@ const InputSetter = { if (!Array.isArray(this.config)) this.config = [this.config]; - this.config.forEach(config => this.setInput(config, selectedItem)); + this.config.forEach((config) => this.setInput(config, selectedItem)); }, setInput(config, selectedItem) { diff --git a/app/assets/javascripts/droplab/utils.js b/app/assets/javascripts/droplab/utils.js index df3c5c2132a..d7f49bf19d8 100644 --- a/app/assets/javascripts/droplab/utils.js +++ b/app/assets/javascripts/droplab/utils.js @@ -5,12 +5,7 @@ import { DATA_TRIGGER, DATA_DROPDOWN, TEMPLATE_REGEX } from './constants'; const utils = { toCamelCase(attr) { - return this.camelize( - attr - .split('-') - .slice(1) - .join(' '), - ); + return this.camelize(attr.split('-').slice(1).join(' ')); }, template(templateString, data) { |