Class: SimpleTimeInput
- Inherits:
-
SimpleForm::Inputs::StringInput
- Object
- SimpleForm::Inputs::StringInput
- SimpleTimeInput
- Defined in:
- app/inputs/simple_time_input.rb
Instance Method Summary collapse
- #icon_clock ⇒ Object
- #input(_wrapper_options) ⇒ Object
- #input_column ⇒ Object
- #input_type ⇒ Object
- #prefix_column ⇒ Object
Instance Method Details
#icon_clock ⇒ Object
27 28 29 |
# File 'app/inputs/simple_time_input.rb', line 27 def icon_clock "<span class='prefix'><i class='far fa-clock'></i></span>".html_safe end |
#input(_wrapper_options) ⇒ Object
4 5 6 7 8 9 |
# File 'app/inputs/simple_time_input.rb', line 4 def input() template.content_tag(:div, class: "row collapse datepicker-wrapper") do template.concat prefix_column template.concat input_column end end |
#input_column ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/inputs/simple_time_input.rb', line 17 def input_column = [:class] ||= [] template.content_tag(:div, class: "large-10 columns") do time = @builder.object.public_send(attribute_name) value = time.present? ? I18n.l(time, format: :time) : "" template.concat @builder.text_field(attribute_name, .merge(value: value)) end end |
#input_type ⇒ Object
31 32 33 |
# File 'app/inputs/simple_time_input.rb', line 31 def input_type :string end |
#prefix_column ⇒ Object
11 12 13 14 15 |
# File 'app/inputs/simple_time_input.rb', line 11 def prefix_column template.content_tag(:div, class: "large-2 columns") do template.concat icon_clock end end |