Class: GOVUKDesignSystemFormBuilder::Elements::TextArea
- Includes:
- Traits::Error, Traits::HTMLAttributes, Traits::HTMLClasses, Traits::Hint, Traits::Label, Traits::Supplemental
- Defined in:
- lib/govuk_design_system_formbuilder/elements/text_area.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, hint:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group:, description_other_text:, under_limit_other_text:, under_limit_one_text:, at_limit_text:, over_limit_other_text:, over_limit_one_text:, **kwargs, &block) ⇒ TextArea
constructor
A new instance of TextArea.
Methods included from Traits::HTMLClasses
Methods included from Traits::HTMLAttributes
Methods included from Traits::Hint
Methods included from Traits::Error
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, hint:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group:, description_other_text:, under_limit_other_text:, under_limit_one_text:, at_limit_text:, over_limit_other_text:, over_limit_one_text:, **kwargs, &block) ⇒ TextArea
Returns a new instance of TextArea.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/govuk_design_system_formbuilder/elements/text_area.rb', line 13 def initialize( builder, object_name, attribute_name, hint:, label:, caption:, rows:, max_words:, max_chars:, threshold:, form_group:, description_other_text:, under_limit_other_text:, under_limit_one_text:, at_limit_text:, over_limit_other_text:, over_limit_one_text:, **kwargs, &block ) super(builder, object_name, attribute_name, &block) fail ArgumentError, 'limit can be words or chars' if max_words && max_chars @label = label @caption = caption @hint = hint @max_words = max_words @max_chars = max_chars @threshold = threshold @rows = rows @form_group = form_group @html_attributes = kwargs @description_other_text = description_other_text @under_limit_other_text = under_limit_other_text @under_limit_one_text = under_limit_one_text @at_limit_text = at_limit_text @over_limit_other_text = over_limit_other_text @over_limit_one_text = over_limit_one_text end |
Instance Method Details
#html ⇒ Object
56 57 58 59 60 |
# File 'lib/govuk_design_system_formbuilder/elements/text_area.rb', line 56 def html Containers::FormGroup.new(*bound, **@form_group.merge(), **i18n_data).html do safe_join([label_element, supplemental_content, hint_element, error_element, text_area, limit_description]) end end |