From 40936da562774924724c12b6113239059341c078 Mon Sep 17 00:00:00 2001 From: Rolf Schmidt Date: Wed, 28 Oct 2020 16:58:55 +0100 Subject: [PATCH] Fixes #3124 - Nested Tree Select value not translatable. --- .../_ui_element/_application_ui_element.coffee | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) 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 26242bd4a..908be1ad7 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 @@ -42,15 +42,22 @@ class App.UiElement.ApplicationUiElement else attribute.options[''] = '-' - @getConfigOptionList: (attribute) -> + @getConfigOptionListArray: (attribute, selection) -> + result = [] + for row in selection + if attribute.translate + row.name = App.i18n.translateInline(row.name) + if !_.isEmpty(row.children) + row.children = @getConfigOptionListArray(attribute, row.children) + result.push row + result + + @getConfigOptionList: (attribute, children = false) -> return if _.isEmpty(attribute.options) selection = attribute.options attribute.options = [] if _.isArray(selection) - for row in selection - if attribute.translate - row.name = App.i18n.translateInline(row.name) - attribute.options.push row + attribute.options = @getConfigOptionListArray(attribute, selection) else forceString = (s) -> return if !selection[s] || !selection[s].toString then '' else selection[s].toString()