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
-
#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
- #input_type ⇒ Object
- #prefix_column(_wrapper_options = {}) ⇒ Object
Instance Method Details
#class_name ⇒ Object
38 39 40 |
# File 'app/inputs/date_picker_input.rb', line 38 def class_name "datepicker" end |
#icon_calendar ⇒ Object
30 31 32 |
# File 'app/inputs/date_picker_input.rb', line 30 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.tag.div(class: "row collapse #{class_name}-wrapper") do template.concat prefix_column template.concat input_column end end |
#input_column(_wrapper_options = {}) ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'app/inputs/date_picker_input.rb', line 19 def input_column( = {}) = [:class] ||= [] [:class] << class_name template.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
34 35 36 |
# File 'app/inputs/date_picker_input.rb', line 34 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.tag.div(class: "small-2 columns") do template.concat icon_calendar end end |