Class: Trestle::Form::Fields::RangeField

Inherits:
Trestle::Form::Field show all
Defined in:
lib/trestle/form/fields/range_field.rb

Instance Attribute Summary

Attributes inherited from Trestle::Form::Field

#block, #builder, #name, #options, #template

Instance Method Summary collapse

Methods inherited from Trestle::Form::Field

#defaults, #errors, #form_group, #initialize, #readonly?, #render

Constructor Details

This class inherits a constructor from Trestle::Form::Field

Instance Method Details

#custom?Boolean

Returns:

  • (Boolean)

9
10
11
# File 'lib/trestle/form/fields/range_field.rb', line 9

def custom?
  options[:custom] != false
end

#fieldObject


5
6
7
# File 'lib/trestle/form/fields/range_field.rb', line 5

def field
  builder.raw_range_field(name, options)
end

#normalize_options!Object


13
14
15
16
17
# File 'lib/trestle/form/fields/range_field.rb', line 13

def normalize_options!
  options.reverse_merge!(class: ["custom-range"]) if custom?

  super
end