Class: GOVUKDesignSystemFormBuilder::Elements::CheckBoxes::CollectionCheckBox
- Inherits:
-
Base
- Object
- Base
- GOVUKDesignSystemFormBuilder::Elements::CheckBoxes::CollectionCheckBox
- Includes:
- Traits::CollectionItem, Traits::Hint
- Defined in:
- lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb
Instance Method Summary collapse
- #html ⇒ Object
-
#initialize(builder, object_name, attribute_name, checkbox, hint_method = nil, link_errors: false) ⇒ CollectionCheckBox
constructor
A new instance of CollectionCheckBox.
Methods included from Traits::Hint
Methods inherited from Base
Constructor Details
#initialize(builder, object_name, attribute_name, checkbox, hint_method = nil, link_errors: false) ⇒ CollectionCheckBox
Returns a new instance of CollectionCheckBox.
8 9 10 11 12 13 14 15 16 |
# File 'lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb', line 8 def initialize(builder, object_name, attribute_name, checkbox, hint_method = nil, link_errors: false) super(builder, object_name, attribute_name) @checkbox = checkbox @item = checkbox.object @value = checkbox.value @hint = { text: retrieve(@item, hint_method) } @link_errors = link_errors end |
Instance Method Details
#html ⇒ Object
18 19 20 21 22 |
# File 'lib/govuk_design_system_formbuilder/elements/check_boxes/collection_check_box.rb', line 18 def html tag.div(class: %(#{brand}-checkboxes__item)) do safe_join([check_box, label_element, hint_element]) end end |