diff --git a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee index 9bceebe26..ba0bd079d 100644 --- a/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee +++ b/app/assets/javascripts/app/controllers/_application_controller_form.js.coffee @@ -2094,7 +2094,14 @@ class App.ControllerForm extends App.Controller _sortOptions: (attribute) -> return if !attribute.options - return if _.isArray( attribute.options ) + + if _.isArray( attribute.options ) + # reverse if we have to exit early, if configured + if attribute.order + if attribute.order == 'DESC' + attribute.options = attribute.options.reverse() + return + options_by_name = [] for i in attribute.options options_by_name.push i['name'].toString().toLowerCase() @@ -2109,6 +2116,11 @@ class App.ControllerForm extends App.Controller options_new.push ii attribute.options = options_new + # do a final reverse, if configured + if attribute.order + if attribute.order == 'DESC' + attribute.options = attribute.options.reverse() + _addNullOption: (attribute) -> return if !attribute.options return if !attribute.nulloption