Module: SimpleForm::Components::Suffix
- Defined in:
- lib/mtl/simple_form/suffix.rb
Overview
Support for ‘suffix:` option when using the simple_form gem. When using the provided `simple_form.rb` initializer everything should be properly setup to make use of this input component.
## Usage
Render a field with the suffix CHF:
“‘erb
<%= f.input :amount, suffix: 'CHF' %>
“‘
Pass in custom HTML options to the suffix div:
“‘erb
<%= f.input :amount, suffix: 'CHF', suffix_html: { class: 'red-text' } %>
“‘
Instance Method Summary collapse
Instance Method Details
#suffix(_wrapper_options = nil) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/mtl/simple_form/suffix.rb', line 24 def suffix( = nil) return unless suffix? @suffix_tag ||= begin additional_classes << 'has-suffix' template.content_tag :div, suffix_label, end end |