Class: Alchemy::Ingredients::NumberEditor
- Inherits:
-
BaseEditor
- Object
- ViewComponent::Base
- BaseEditor
- Alchemy::Ingredients::NumberEditor
- Defined in:
- app/components/alchemy/ingredients/number_editor.rb
Instance Attribute Summary
Attributes inherited from BaseEditor
Instance Method Summary collapse
Methods inherited from BaseEditor
#call, #form_field_id, #form_field_name, #initialize
Constructor Details
This class inherits a constructor from Alchemy::Ingredients::BaseEditor
Instance Method Details
#input_field ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'app/components/alchemy/ingredients/number_editor.rb', line 6 def input_field tag.div(class: "input-field") do concat text_field_tag(form_field_name, value, type: settings[:input_type] || "number", required: presence_validation?, step: settings[:step], min: settings[:min], max: settings[:max], id: form_field_id, readonly: !editable?, oninput: (settings[:input_type] == "range") ? "this.nextElementSibling.value = this.value" : nil) if settings[:input_type] == "range" concat tag.output(value) end if settings[:unit] concat tag.div(settings[:unit], class: "input-addon right") end end end |