From 2b813331139dff50e509166414bc71098d898099 Mon Sep 17 00:00:00 2001 From: Uwe Kubosch Date: Tue, 19 Mar 2024 09:03:45 +0100 Subject: [PATCH] Handle array addons for select fields --- build.gradle | 2 +- src/main/resources/ruby/form_helper.rb | 12 +++++++----- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/build.gradle b/build.gradle index a078d98..eab4660 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group 'no.datek' -version '0.15.0' +version '0.16.0' final String JRUBY_VERSION = '9.4.5.0'; repositories { diff --git a/src/main/resources/ruby/form_helper.rb b/src/main/resources/ruby/form_helper.rb index 9e319b0..3ab9ede 100644 --- a/src/main/resources/ruby/form_helper.rb +++ b/src/main/resources/ruby/form_helper.rb @@ -326,7 +326,7 @@ def bootstrap_select_input(object, field_name, option_map = [], **opts, &block) wrapper_class = opts.key?(:wrapper_class) ? opts.delete(:wrapper_class) : WRAPPER_CLASS append = opts.delete(:append) - if hide_label + if hide_label || wrapper_class.blank? html = +"" else html = +%{} @@ -335,10 +335,12 @@ def bootstrap_select_input(object, field_name, option_map = [], **opts, &block) html << %{
} if append html << select_input(object, field_name, option_map, class: classes, no_break: true, **opts, &block) if append - if append.include?('btn') || append.include?('input') - html << append - else - html << %{#{append}} + [*append].each do |addon| + if addon.start_with?('<') + html << addon + else + html << %{#{addon}} + end end html << '
' end