Module: StimulusPlumbers::Form::Fields::Choice
- Included in:
- Builder
- Defined in:
- lib/stimulus_plumbers/form/fields/choice.rb
Instance Method Summary collapse
- #check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
- #radio_button(attribute, tag_value, options = {}) ⇒ Object
Instance Method Details
#check_box(attribute, options = {}, checked_value = "1", unchecked_value = "0") ⇒ Object
7 8 9 10 11 12 13 |
# File 'lib/stimulus_plumbers/form/fields/choice.rb', line 7 def check_box(attribute, = {}, checked_value = "1", unchecked_value = "0") rails_opts, form_field_opts = () form_field_opts[:layout] ||= :inline field = build_field(attribute, form_field_opts) html_opts = (rails_opts, field_theme(:form_checkbox, error: field.error?), field.html_opts) render_field(field, super(attribute, html_opts, checked_value, unchecked_value)) end |
#radio_button(attribute, tag_value, options = {}) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/stimulus_plumbers/form/fields/choice.rb', line 15 def (attribute, tag_value, = {}) rails_opts, form_field_opts = () form_field_opts[:layout] ||= :inline field = build_field(attribute, form_field_opts, input_id: field_id(attribute, tag_value)) html_opts = (rails_opts, field_theme(:form_radio, error: field.error?), field.html_opts) render_field(field, super(attribute, tag_value, html_opts)) end |