class WCC::Styles::SimpleForm::TimePickerInput

Public Instance Methods

input(wrapper_options=nil) click to toggle source
# 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.content_tag(: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

Private Instance Methods

localize_for_picker(time, format = picker_format) click to toggle source
# File lib/wcc/styles/simple_form/time_picker_input.rb, line 23
def localize_for_picker(time, format = picker_format)
  time.present? ? l(time, format: format) : nil
end
picker_format() click to toggle source
# File lib/wcc/styles/simple_form/time_picker_input.rb, line 27
def picker_format
  :picker
end