Module: Releaf::Builders::FormBuilder::NumberFields

Included in:
Fields
Defined in:
app/builders/releaf/builders/form_builder/number_fields.rb

Instance Method Summary collapse

Instance Method Details

#releaf_number_field(name, input: {}, label: {}, field: {}, options: {}, &block) ⇒ Object Also known as: releaf_integer_field, releaf_float_field, releaf_decimal_field


2
3
4
5
6
7
8
# File 'app/builders/releaf/builders/form_builder/number_fields.rb', line 2

def releaf_number_field(name, input: {}, label: {}, field: {}, options: {}, &block)
  attributes = input_attributes(name, {value: object.send(name), step: "any", class: "text" }.merge(input), options)
  options = {field: {type: "number"}}.deep_merge(options)
  content = number_field(name, attributes)

  input_wrapper_with_label(name, content, label: label, field: field, options: options, &block)
end