From: Aleksander Ɓukasz Date: Tue, 25 Mar 2014 13:03:54 +0000 (+0100) Subject: editor: openSelect view - hide list trigger on empty items list X-Git-Url: https://git.mdrn.pl/fnpeditor.git/commitdiff_plain/84f4d7abd8501301c22d9be0565a392d33fd9cd9 editor: openSelect view - hide list trigger on empty items list --- diff --git a/src/editor/views/openSelect/openSelect.js b/src/editor/views/openSelect/openSelect.js index 451570e..eeea988 100644 --- a/src/editor/views/openSelect/openSelect.js +++ b/src/editor/views/openSelect/openSelect.js @@ -19,13 +19,18 @@ var OpenSelect = Backbone.View.extend({ this.$el.append(_.template(template)({value: this.options.value || ''})); this.$('.toggle').dropdown(); this.menu = this.$('.dropdown-menu'); + this.toggleHandler(false); if(this.options.inputTemplate) { this.input = $(this.options.inputTemplate); this.$('.input-wrapper').append(this.input); } }, + toggleHandler: function(toggle) { + this.$('.toggle').css('visibility', toggle ? 'inherit' : 'hidden'); + }, addItem: function(value) { this.menu.append(_.template(itemTemplate)({value: value})); + this.toggleHandler(true); }, onSelection: function(e) { var val = $(e.target).text();