Class: DatePickerInput
- Inherits:
-
SimpleForm::Inputs::StringInput
- Object
- SimpleForm::Inputs::StringInput
- DatePickerInput
- Defined in:
- app/inputs/date_picker_input.rb
Direct Known Subclasses
Instance Method Summary collapse
- #class_name ⇒ Object
-
#icon_calendar ⇒ Object
rubocop:enable Metrics/AbcSize.
-
#input(_wrapper_options) ⇒ Object
Note that where we use ‘wrapper: :clockpicker` or `wrapper: horizontal_clockpicker`, #input is not called and we call #prefix_column and #input_column directly.
-
#input_column(_wrapper_options = {}) ⇒ Object
rubocop:disable Metrics/AbcSize.
- #input_type ⇒ Object
- #prefix_column(_wrapper_options = {}) ⇒ Object
Instance Method Details
#class_name ⇒ Object
40 41 42 |
# File 'app/inputs/date_picker_input.rb', line 40 def class_name "datepicker" end |
#icon_calendar ⇒ Object
rubocop:enable Metrics/AbcSize
32 33 34 |
# File 'app/inputs/date_picker_input.rb', line 32 def icon_calendar "<span class='prefix'><i class='far fa-calendar'></i></span>".html_safe end |
#input(_wrapper_options) ⇒ Object
Note that where we use ‘wrapper: :clockpicker` or `wrapper: horizontal_clockpicker`, #input is not called and we call #prefix_column and #input_column directly.
6 7 8 9 10 11 |
# File 'app/inputs/date_picker_input.rb', line 6 def input() template.content_tag(:div, class: "row collapse #{class_name}-wrapper") do template.concat prefix_column template.concat input_column end end |
#input_column(_wrapper_options = {}) ⇒ Object
rubocop:disable Metrics/AbcSize
20 21 22 23 24 25 26 27 28 29 |
# File 'app/inputs/date_picker_input.rb', line 20 def input_column( = {}) = [:class] ||= [] [:class] << class_name template.content_tag(:div, class: "small-10 columns") do datestamp = @builder.object.public_send(attribute_name) value = format_date(datestamp) template.concat @builder.text_field(attribute_name, .merge(value: value)) end end |
#input_type ⇒ Object
36 37 38 |
# File 'app/inputs/date_picker_input.rb', line 36 def input_type :string end |
#prefix_column(_wrapper_options = {}) ⇒ Object
13 14 15 16 17 |
# File 'app/inputs/date_picker_input.rb', line 13 def prefix_column( = {}) template.content_tag(:div, class: "small-2 columns") do template.concat icon_calendar end end |