Module: Trestle::Form::Fields::DatePicker

Included in:
DateField, DatetimeField, TimeField
Defined in:
lib/trestle/form/fields/date_picker.rb

Instance Method Summary collapse

Instance Method Details

#default_iconObject


12
13
14
# File 'lib/trestle/form/fields/date_picker.rb', line 12

def default_icon
  icon("fa fa-calendar")
end

#normalize_options!Object


2
3
4
5
6
7
8
9
10
# File 'lib/trestle/form/fields/date_picker.rb', line 2

def normalize_options!
  options[:prepend] ||= options.delete(:icon) { default_icon }

  unless options[:disabled] || options[:readonly]
    options.reverse_merge!(data: { picker: options.delete(:picker) { true }, allow_clear: true })
  end

  super
end