Class: Barnardos::RubyDesignSystem::Inputs::CollectionCheckBoxesInput
- Inherits:
-
SimpleForm::Inputs::CollectionCheckBoxesInput
- Object
- SimpleForm::Inputs::CollectionCheckBoxesInput
- Barnardos::RubyDesignSystem::Inputs::CollectionCheckBoxesInput
- Defined in:
- lib/barnardos/ruby_design_system/inputs/collection_check_boxes_input.rb
Overview
Overrides behaviour of the collection check boxes input in simple_form forms.
Usage: Add the following class to the host project at app/inputs/collection_check_boxes_input.rb
class CollectionCheckBoxesInput < Barnardos::RubyDesignSystem::Inputs::CollectionCheckBoxesInput; end
With that in place, the following code will output a set of collection boxes wrapped in the required Design System components:
<%= simple_form_for(foo) do |form| %>
<%= form.association :bars, as: :check_boxes, wrapper: :in_fieldset, boolean_style: :inline %>
<% end %>
Where foo has_many bars
Direct Known Subclasses
Instance Method Summary collapse
Instance Method Details
#input(wrapper_options = nil) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/barnardos/ruby_design_system/inputs/collection_check_boxes_input.rb', line 23 def input( = nil) input_html_classes.unshift('Switch-input') [:item_label_class] = 'Switch-label' [:item_wrapper_tag] = :div [:item_wrapper_class] = 'Switches-item Switch Switch--checkbox' template.content_tag(:div, super, class: 'Switches-items') end |