Module: Trestle::Form::Fields::DatePicker
- Included in:
- DateField, DatetimeField, TimeField
- Defined in:
- lib/trestle/form/fields/date_picker.rb
Instance Method Summary collapse
- #controller ⇒ Object
- #default_icon ⇒ Object
- #defaults ⇒ Object
- #enable_date_picker? ⇒ Boolean
- #normalize_options! ⇒ Object
Instance Method Details
#controller ⇒ Object
24 25 26 |
# File 'lib/trestle/form/fields/date_picker.rb', line 24 def controller "datepicker" end |
#default_icon ⇒ Object
16 17 18 |
# File 'lib/trestle/form/fields/date_picker.rb', line 16 def default_icon icon("fa fa-calendar") end |
#defaults ⇒ Object
10 11 12 13 14 |
# File 'lib/trestle/form/fields/date_picker.rb', line 10 def defaults defaults = super defaults.merge!(data: { controller: controller, allow_clear: true }) if enable_date_picker? defaults end |
#enable_date_picker? ⇒ Boolean
20 21 22 |
# File 'lib/trestle/form/fields/date_picker.rb', line 20 def enable_date_picker? !disabled? && !readonly? && [:picker] != false end |
#normalize_options! ⇒ Object
2 3 4 5 6 7 8 |
# File 'lib/trestle/form/fields/date_picker.rb', line 2 def unless [:prepend] == false [:prepend] ||= .delete(:icon) { default_icon } end super end |