Skip to content

Commit

Permalink
Handle array addons for select fields
Browse files Browse the repository at this point in the history
  • Loading branch information
UweKubosch committed Mar 19, 2024
1 parent e98d229 commit 2b81333
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 7 additions & 5 deletions src/main/resources/ruby/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 = +%{<label for="#{opts[:id]}" class="#{label_class}" style="#{label_style}">#{CGI.escapeHTML(label)}</label>}
Expand All @@ -335,10 +335,12 @@ def bootstrap_select_input(object, field_name, option_map = [], **opts, &block)
html << %{<div class="input-group flex-nowrap" >} 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 << %{<span class="input-group-text">#{append}</span>}
[*append].each do |addon|
if addon.start_with?('<')
html << addon
else
html << %{<span class="input-group-text">#{addon}</span>}
end
end
html << '</div>'
end
Expand Down

0 comments on commit 2b81333

Please sign in to comment.