Class: Components::NumericInputRow

Inherits:
InputRow
  • Object
show all
Defined in:
app/components/numeric_input_row.rb

Instance Method Summary collapse

Constructor Details

#initialize(form:, attribute:, label:, unit: nil, help: nil, options: {}) ⇒ NumericInputRow

Returns a new instance of NumericInputRow.



2
3
4
5
# File 'app/components/numeric_input_row.rb', line 2

def initialize(form:, attribute:, label:, unit: nil, help: nil, options: {})
  @unit = unit
  super(form: form, attribute: attribute, label: label, help: help, options: options)
end

Instance Method Details

#input_element ⇒ Object



7
8
9
10
# File 'app/components/numeric_input_row.rb', line 7

def input_element
  raw @form.number_field(@attribute, {class: "form-control"}.merge(@options)) # rubocop:disable Rails/OutputSafety
  span(class: "input-group-text") { @unit } if @unit
end