Class: DatePickerTimeInput
- Inherits:
-
SimpleForm::Inputs::StringInput
- Object
- SimpleForm::Inputs::StringInput
- DatePickerTimeInput
- Defined in:
- app/inputs/date_picker_time_input.rb
Overview
DateTime picker using bootstrap-datepicker for the time part.
Requires date_time_attribute
gem (+workaround) and active on the attribute.
Instance Method Summary collapse
Instance Method Details
#input(wrapper_options) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/inputs/date_picker_time_input.rb', line 8 def input() = (, ) # Date format must match datepicker's, see app/assets/application.js . # And for html5 inputs, match RFC3339, see http://dev.w3.org/html5/markup/datatypes.html#form.data.date . # In the future, use html5 date&time inputs. This needs modernizr or equiv. to avoid # double widgets, and perhaps conditional css to adjust input width (chrome). value = @builder.object.send attribute_name = { as: :string, class: 'input-small datepicker' } = { as: :string, class: 'input-mini' } @builder.input_field("#{attribute_name}_date_value", .merge()) + ' ' + @builder.input_field("#{attribute_name}_time_value", .merge()) # time_select requires a date_select # @builder.time_select("#{attribute_name}_time", {ignore_date: true}, input_html_options.merge(time_options)) end |
#label_target ⇒ Object
23 24 25 |
# File 'app/inputs/date_picker_time_input.rb', line 23 def label_target "#{attribute_name}_date_value" end |