Class: Effective::FormInputs::DateField
- Inherits:
-
DatetimeField
- Object
- Effective::FormInput
- DatetimeField
- Effective::FormInputs::DateField
- Defined in:
- app/models/effective/form_inputs/date_field.rb
Constant Summary
Constants inherited from Effective::FormInput
Effective::FormInput::BLANK, Effective::FormInput::DEFAULT_FEEDBACK_OPTIONS, Effective::FormInput::DEFAULT_INPUT_GROUP_OPTIONS, Effective::FormInput::EMPTY_HASH, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES, Effective::FormInput::HORIZONTAL_LABEL_OPTIONS, Effective::FormInput::HORIZONTAL_WRAPPER_OPTIONS, Effective::FormInput::INLINE_LABEL_OPTIONS, Effective::FormInput::VERTICAL_WRAPPER_OPTIONS
Instance Attribute Summary
Attributes inherited from Effective::FormInput
Instance Method Summary collapse
-
#datetime_to_s ⇒ Object
ruby.
-
#format ⇒ Object
moment.js.
- #input_group_options ⇒ Object
- #input_html_options ⇒ Object
- #input_js_options ⇒ Object
-
#pattern ⇒ Object
html.
Methods inherited from DatetimeField
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_s ⇒ Object
ruby
26 27 28 |
# File 'app/models/effective/form_inputs/date_field.rb', line 26 def datetime_to_s # ruby (value&.strftime('%F') rescue nil) end |
#format ⇒ Object
moment.js
34 35 36 |
# File 'app/models/effective/form_inputs/date_field.rb', line 34 def format # moment.js 'YYYY-MM-DD' end |
#input_group_options ⇒ Object
19 20 21 22 23 24 |
# File 'app/models/effective/form_inputs/date_field.rb', line 19 def { input_group: { class: 'input-group effective_date_time_picker_input_group' }, prepend: (content_tag(:span, icon('calendar'), class: 'input-group-text') unless readonly?) } end |
#input_html_options ⇒ Object
7 8 9 10 11 12 13 |
# File 'app/models/effective/form_inputs/date_field.rb', line 7 def { class: ['form-control', 'effective_date_time_picker', 'effective_date', ('not-date-linked' if not_date_linked?)].compact.join(' '), pattern: pattern, id: tag_id } end |
#input_js_options ⇒ Object
15 16 17 |
# File 'app/models/effective/form_inputs/date_field.rb', line 15 def { format: format, showTodayButton: false, showClear: false, useCurrent: 'hour', disabledDates: disabled_dates.presence, minDate: min_date.presence, maxDate: max_date.presence, locale: I18n.locale }.compact end |
#pattern ⇒ Object
html
30 31 32 |
# File 'app/models/effective/form_inputs/date_field.rb', line 30 def pattern # html '\d{4}(-\d{2})?(-\d{2})?' end |