Class: Effective::FormInputs::DateField

Inherits:
DatetimeField show all
Defined in:
app/models/effective/form_inputs/date_field.rb

Constant Summary

Constants inherited from Effective::FormInput

Effective::FormInput::BLANK, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES

Instance Attribute Summary

Attributes inherited from Effective::FormInput

#name, #options

Instance Method Summary collapse

Methods inherited from DatetimeField

#build_input

Methods inherited from Effective::FormInput

#feedback_options, #hint_options, #initialize, #label_options, #to_html, #wrapper_options

Constructor Details

This class inherits a constructor from Effective::FormInput

Instance Method Details

#datetime_to_sObject



20
21
22
# File 'app/models/effective/form_inputs/date_field.rb', line 20

def datetime_to_s
  value&.strftime('%F')
end

#input_group_optionsObject



16
17
18
# File 'app/models/effective/form_inputs/date_field.rb', line 16

def input_group_options
  { input_group: { class: 'input-group' }, prepend: (:span, icon('calendar'), class: 'input-group-text') }
end

#input_html_optionsObject



5
6
7
8
9
10
# File 'app/models/effective/form_inputs/date_field.rb', line 5

def input_html_options
  {
    class: ['form-control', 'effective_date_time_picker', 'effective_date', ('not-date-linked' if not_date_linked?)].compact.join(' '),
    pattern: '\d{4}(-\d{2})?(-\d{2})?'
  }
end

#input_js_optionsObject



12
13
14
# File 'app/models/effective/form_inputs/date_field.rb', line 12

def input_js_options
  { format: 'YYYY-MM-DD', showTodayButton: true, showClear: true, useCurrent: 'hour', disabledDates: disabled_dates.presence }.compact
end