From 84f4d7abd8501301c22d9be0565a392d33fd9cd9 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Aleksander=20=C5=81ukasz?= Date: Tue, 25 Mar 2014 14:03:54 +0100 Subject: [PATCH] editor: openSelect view - hide list trigger on empty items list --- src/editor/views/openSelect/openSelect.js | 5 +++++ 1 file changed, 5 insertions(+) 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(); -- 2.20.1