Class: ClockPickerInput
- Inherits:
-
SimpleForm::Inputs::StringInput
- Object
- SimpleForm::Inputs::StringInput
- ClockPickerInput
- Defined in:
- app/inputs/clock_picker_input.rb
Instance Method Summary collapse
- #class_name ⇒ Object
- #icon_clock ⇒ 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/clock_picker_input.rb', line 38 def class_name "clockpicker" end |
#icon_clock ⇒ Object
30 31 32 |
# File 'app/inputs/clock_picker_input.rb', line 30 def icon_clock "<span class='prefix'><i class='far fa-clock'></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/clock_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
19 20 21 22 23 24 25 26 27 28 |
# File 'app/inputs/clock_picker_input.rb', line 19 def input_column( = {}) = [:class] ||= [] [:class] << class_name template.content_tag(:div, class: "small-9 columns") do datestamp = @builder.object.public_send(attribute_name) value = datestamp.present? ? I18n.l(datestamp, format: :time) : "" template.concat @builder.text_field(attribute_name, .merge(value: value)) end end |
#input_type ⇒ Object
34 35 36 |
# File 'app/inputs/clock_picker_input.rb', line 34 def input_type :string end |
#prefix_column(_wrapper_options = {}) ⇒ Object
13 14 15 16 17 |
# File 'app/inputs/clock_picker_input.rb', line 13 def prefix_column( = {}) template.content_tag(:div, class: "small-3 input-group-addon columns") do template.concat(icon_clock) end end |