class Barnardos::RubyDesignSystem::Inputs::CollectionCheckBoxesInput
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`
Public Instance Methods
input(wrapper_options = nil)
click to toggle source
Calls superclass method
# File lib/barnardos/ruby_design_system/inputs/collection_check_boxes_input.rb, line 23 def input(wrapper_options = nil) input_html_classes.unshift('Switch-input') options[:item_label_class] = 'Switch-label' options[:item_wrapper_tag] = :div options[:item_wrapper_class] = 'Switches-item Switch Switch--checkbox' template.content_tag(:div, super, class: 'Switches-items') end