From 8cca38ff5e4d05c85dfb137b29c419e5df8299e0 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Mon, 8 Jan 2018 17:52:50 -0300 Subject: [PATCH] 12479: Removed plugin. Fixed onFocus() behavior on strict listings. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- .../javascripts/components/edit_tags.js | 59 +------------------ 1 file changed, 2 insertions(+), 57 deletions(-) diff --git a/apps/workbench/app/assets/javascripts/components/edit_tags.js b/apps/workbench/app/assets/javascripts/components/edit_tags.js index 583047cb84..bea0697b60 100644 --- a/apps/workbench/app/assets/javascripts/components/edit_tags.js +++ b/apps/workbench/app/assets/javascripts/components/edit_tags.js @@ -2,60 +2,6 @@ // // SPDX-License-Identifier: AGPL-3.0 -// Plugin taken from: https://gist.github.com/thiago-negri/132bf33b5312e2da823c -// This behavior seems to be planned to be integrated on the next selectize release -Selectize.define('no_results', function(options) { - var self = this; - - options = $ - .extend({message: 'No results found.', html: function(data) { - return (''); - }}, options); - - self.displayEmptyResultsMessage = function() { - this.$empty_results_container.css('top', this.$control.outerHeight()); - this.$empty_results_container.css('width', this.$control.outerWidth()); - this.$empty_results_container.show(); - }; - - self.on('type', function(str) { - if (str && !self.hasOptions) { - self.displayEmptyResultsMessage(); - } else { - self.$empty_results_container.hide(); - } - }); - - self.onKeyDown = (function() { - var original = self.onKeyDown; - - return function(e) { - original.apply(self, arguments); - this.$empty_results_container.hide(); - } - })(); - - self.onBlur = (function() { - var original = self.onBlur; - - return function() { - original.apply(self, arguments); - this.$empty_results_container.hide(); - }; - })(); - - self.setup = (function() { - var original = self.setup; - return function() { - original.apply(self, arguments); - self.$empty_results_container = $(options.html( - $.extend({classNames: self.$input.attr('class')}, options))); - self.$empty_results_container.insertBefore(self.$dropdown); - self.$empty_results_container.hide(); - }; - })(); -}); - window.SimpleInput = { view: function(vnode) { return m("input.form-control", { @@ -83,10 +29,10 @@ window.SimpleInput = { window.SelectOrAutocomplete = { onFocus: function(vnode) { // Allow the user to edit an already entered value by removing it - // and filling the input field with the same text + // and filling the input field with the same text. (non-strict listings) var activeSelect = vnode.state.selectized[0].selectize value = activeSelect.getValue() - if (value.length > 0) { + if (vnode.attrs.create && value.length > 0) { activeSelect.clear(silent = true) activeSelect.setTextboxValue(value) } @@ -102,7 +48,6 @@ window.SelectOrAutocomplete = { }, oncreate: function(vnode) { vnode.state.selectized = $(vnode.dom).selectize({ - plugins: ['no_results'], labelField: 'value', valueField: 'value', searchField: 'value', -- 2.30.2