Class: Superform::Rails::Components::Checkboxes
- Defined in:
- lib/superform/rails/components/checkboxes.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize(field, options: [], **attributes) ⇒ Checkboxes
constructor
A new instance of Checkboxes.
- #view_template(&block) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize(field, options: [], **attributes) ⇒ Checkboxes
Returns a new instance of Checkboxes.
5 6 7 8 |
# File 'lib/superform/rails/components/checkboxes.rb', line 5 def initialize(field, options: [], **attributes) super(field, **attributes) @options = end |
Instance Method Details
#view_template(&block) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/superform/rails/components/checkboxes.rb', line 10 def view_template(&block) choices.each do |choice| if block yield choice else label(for: DOM.join(dom.id, choice.index)) do render choice.build_input whitespace plain choice.text end end end end |