From ac1dcecff320962d8353cda0f00df92fe8ffb9ac Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 23 Sep 2015 13:23:51 +0200 Subject: [PATCH] Fixed searchable select. --- .../_ui_element/searchable_select.js.coffee | 32 +++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee index bc44fbd8c..bc7bf5519 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/searchable_select.js.coffee @@ -1,3 +1,31 @@ -class App.UiElement.searchable_select - @render: (attribute) -> +class App.UiElement.searchable_select extends App.UiElement.ApplicationUiElement + @render: (attribute, params) -> + + # set multiple option + if attribute.multiple + attribute.multiple = 'multiple' + else + attribute.multiple = '' + + # build options list based on config + @getConfigOptionList( attribute, params ) + + # build options list based on relation + @getRelationOptionList( attribute, params ) + + # add null selection if needed + @addNullOption( attribute, params ) + + # sort attribute.options + @sortOptions( attribute, params ) + + # finde selected/checked item of list + @selectedOptions( attribute, params ) + + # disable item of list + @disabledOptions( attribute, params ) + + # filter attributes + @filterOption( attribute, params ) + new App.SearchableSelect( attribute: attribute ).element()