Class: SimpleFormExtension::Inputs::NumericInput

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

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/simple_form_extension/inputs/numeric_input.rb', line 4

def input(wrapper_options = nil)
  input_html_options[:class] << "form-control spinbox-input"
  if options.fetch(:spinner, true)
    "<div class=\"input-group spinbox\">
      #{@builder.text_field(attribute_name, input_html_options)}
      <span class=\"input-group-btn\">
        <span class=\"spinbox-buttons btn-group-vertical\">
          <button class=\"btn btn-default spinbox-up\" type=\"button\" tabindex=\"-1\">
            <i class=\"fa fa-chevron-up\"></i>
          </button>
          <button class=\"btn btn-default spinbox-down\" type=\"button\" tabindex=\"-1\">
            <i class=\"fa fa-chevron-down\"></i>
          </button>
        </span>
      </span>
    </div> ".html_safe

  else
    @builder.number_field(attribute_name, input_html_options)
  end
end