Class: DateTimePickerInput
- Inherits:
-
SimpleForm::Inputs::Base
- Object
- SimpleForm::Inputs::Base
- DateTimePickerInput
- Defined in:
- app/inputs/date_time_picker_input.rb
Instance Method Summary collapse
- #date_input_html_options ⇒ Object
- #input(wrapper_options) ⇒ Object
- #time_input_html_options ⇒ Object
Instance Method Details
#date_input_html_options ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/inputs/date_time_picker_input.rb', line 9 def = { id: "#{attribute_name}_date", class: 'form-control datepicker', name: "#{object_name}[#{attribute_name}_date]", readonly: true, style: 'margin-right: 10px; width: auto; display: inline-block;' } [:value] = @builder.object[attribute_name].strftime("%B %e, %Y") unless @builder.object[attribute_name].nil? end |
#input(wrapper_options) ⇒ Object
2 3 4 5 6 7 |
# File 'app/inputs/date_time_picker_input.rb', line 2 def input() template.content_tag(:div, class: 'form-group date time form_datetime') do template.concat @builder.text_field(attribute_name, ) template.concat @builder.text_field(attribute_name, ) end end |
#time_input_html_options ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'app/inputs/date_time_picker_input.rb', line 22 def = { id: "#{attribute_name}_time", class: 'form-control timepicker', name: "#{object_name}[#{attribute_name}_time]", readonly: true, style: 'width: auto; display: inline-block;' } if @builder.object[attribute_name].nil? [:value] = "12:00 AM" else [:value] = @builder.object[attribute_name].strftime("%I:%M %p") end end |