Class: Effective::FormInputs::DateField
Constant Summary
Effective::FormInput::BLANK, Effective::FormInput::EXCLUSIVE_CLASS_PREFIXES, Effective::FormInput::EXCLUSIVE_CLASS_SUFFIXES
Instance Attribute Summary
#name, #options
Instance Method Summary
collapse
#build_input
#feedback_options, #hint_options, #initialize, #label_options, #to_html, #wrapper_options
Instance Method Details
#datetime_to_s ⇒ Object
20
21
22
|
# File 'app/models/effective/form_inputs/date_field.rb', line 20
def datetime_to_s
value&.strftime('%F')
end
|
16
17
18
|
# File 'app/models/effective/form_inputs/date_field.rb', line 16
def input_group_options
{ input_group: { class: 'input-group' }, prepend: content_tag(:span, icon('calendar'), class: 'input-group-text') }
end
|
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
|
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
|