Class: Barnardos::RubyDesignSystem::Inputs::StringInput

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

Direct Known Subclasses

StringInput

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object

Overrides behaviour of the string input in simple_form forms.

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

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

With that in place, the following code will output a text input wrapped in the required Design System components:

<%= simple_form_for(foo) do |form| %>
  <%= form.input :bar %>
<% end %>

Where bar is a string attribute of foo



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

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