Class: TaoForm::Inputs::NumericInput

Inherits:
SimpleForm::Inputs::NumericInput
  • Object
show all
Defined in:
lib/tao_form/inputs/numeric_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'lib/tao_form/inputs/numeric_input.rb', line 5

def input(wrapper_options = nil)
  origin_input = super
  prefix = options[:prefix].present? ? @builder.label(@attribute_name, options[:prefix], class: 'prefix') : ''
  suffix = options[:suffix].present? ? @builder.label(@attribute_name, options[:suffix], class: 'suffix') : ''

  field_class = ['text-field']
  field_class << 'text-field-with-prefix' if prefix.present?
  field_class << 'text-field-with-suffix' if suffix.present?

  template.(:div, "#{prefix}#{origin_input}#{suffix}".html_safe, class: field_class)
end