Class: Barnardos::RubyDesignSystem::Inputs::CollectionSelectInput

Inherits:
SimpleForm::Inputs::CollectionSelectInput
  • Object
show all
Defined in:
lib/barnardos/ruby_design_system/inputs/collection_select_input.rb

Overview

Overrides behaviour of the collection select input in simple_form forms.

Usage: Add the following class to the host project at app/inputs/collection_select_input.rb

class CollectionSelectInput < Barnardos::RubyDesignSystem::Inputs::CollectionSelectInput; end

With that in place, the following code will output an HTML select input with class Select and wrapped in the required Design System components:

<%= simple_form_for(foo) do |form| %>
  <%= form.association :bars, wrapper: :design_system_select %>
<% end %>

Where foo has_many bars

Direct Known Subclasses

CollectionSelectInput

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



23
24
25
26
# File 'lib/barnardos/ruby_design_system/inputs/collection_select_input.rb', line 23

def input(wrapper_options = nil)
  input_html_classes.unshift('Select')
  super
end