Class: WCC::Styles::SimpleForm::TimePickerInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
lib/wcc/styles/simple_form/time_picker_input.rb

Direct Known Subclasses

DatePickerInput

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/wcc/styles/simple_form/time_picker_input.rb', line 4

def input(wrapper_options=nil)
  input_html_classes.unshift('date')
  merged_input_options = merge_wrapper_options(input_html_options, wrapper_options)

  template.(:div) do
    template.concat @builder.hidden_field(attribute_name, merged_input_options)
    template.concat template.text_field_tag(
      "datetime_picker_#{input_class}",
      localize_for_picker(object.public_send(attribute_name)),
      "id" => "datetime_picker_#{input_class}",
      "class" => "date",
      "data-datetimepicker" => "##{input_class}",
      "data-datetimepicker-options" => (options[:picker] || {}).to_json,
    )
  end
end