diff --git a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee index cc272b47f..546d3e29b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/_application_ui_element.coffee @@ -52,11 +52,9 @@ class App.UiElement.ApplicationUiElement row.name = App.i18n.translateInline(row.name) attribute.options.push row else - order = _.sortBy( - _.keys(selection), (item) -> - return '' if !selection[item] || !selection[item].toString - selection[item].toString().toLowerCase() - ) + forceString = (s) -> + return if !selection[s] || !selection[s].toString then '' else selection[s].toString() + order = _.keys(selection).sort( (a, b) -> forceString(a).localeCompare(forceString(b)) ) for key in order name_new = selection[key] if attribute.translate diff --git a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee index 71fd11be6..99ae033f6 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee @@ -7,6 +7,10 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi if params.data_option_new && !_.isEmpty(params.data_option_new) params.data_option = params.data_option_new + if attribute.value == 'select' && params.data_option? && params.data_option.options? + sorted = _.map params.data_option.options, (value, key) -> [key.toString(), value.toString()] + params.data_option.sorted = sorted.sort( (a, b) -> a[1].localeCompare(b[1]) ) + item = $(App.view('object_manager/attribute')(attribute: attribute)) updateDataMap = (localParams, localAttribute, localAttributes, localClassname, localForm, localA) => diff --git a/app/assets/javascripts/app/views/object_manager/attribute/select.jst.eco b/app/assets/javascripts/app/views/object_manager/attribute/select.jst.eco index 448859052..3328f631e 100644 --- a/app/assets/javascripts/app/views/object_manager/attribute/select.jst.eco +++ b/app/assets/javascripts/app/views/object_manager/attribute/select.jst.eco @@ -8,8 +8,8 @@