From 5e32f6c04a696290f14457c90595836e30e706f0 Mon Sep 17 00:00:00 2001 From: Uwe Kubosch Date: Fri, 6 Dec 2024 14:37:37 +0100 Subject: [PATCH] Add wrapper and label class to the bootstrap_textarea method --- build.gradle | 2 +- src/main/resources/ruby/form_helper.rb | 13 +++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 889bc52..b6d4a42 100644 --- a/build.gradle +++ b/build.gradle @@ -7,7 +7,7 @@ plugins { } group 'no.datek' -version '1.0.7' +version '1.0.8' final String JRUBY_VERSION = '9.4.8.0'; repositories { diff --git a/src/main/resources/ruby/form_helper.rb b/src/main/resources/ruby/form_helper.rb index b39636f..d7244d5 100644 --- a/src/main/resources/ruby/form_helper.rb +++ b/src/main/resources/ruby/form_helper.rb @@ -218,6 +218,7 @@ def hidden_input(object, field_name, **opts) def textarea(object, field_name, **opts) hide_label = opts.delete(:hide_label) || opts.delete(:no_label) + label_class = opts.delete(:label_class) label_style = opts.delete(:label_style) label_key = label_key_opt(opts, field_name) label_suffix = opts.delete(:hide_label_suffix) ? nil : ':' @@ -230,7 +231,7 @@ def textarea(object, field_name, **opts) if hide_label html = +"" else - html = +%{ } + html = +%{ } end html << '' if appendix @@ -249,8 +250,16 @@ def textarea(object, field_name, **opts) end def bootstrap_textarea(object, field_name, **opts) + wrapper_class = opts.key?(:wrapper_class) ? opts.delete(:wrapper_class) : WRAPPER_CLASS + label_class = opts.delete(:label_class) || 'form-label' classes = field_classes(object, field_name, opts.delete(:class)) - textarea(object, field_name, hide_label_suffix: true, class: classes, no_break: true, **opts) + html = textarea(object, field_name, hide_label_suffix: true, class: classes, no_break: true, label_class:, **opts) + if wrapper_class.present? + html = <<~HTML +
#{html}
+ HTML + end + html end private def object_field_value(object, field_name)