Class: SimpleForm::Inputs::TimepickerInput

Inherits:
StringInput
  • Object
show all
Defined in:
lib/datetimepicker/simple_form/inputs/timepicker_input.rb

Instance Method Summary collapse

Instance Method Details

#inputObject



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/datetimepicker/simple_form/inputs/timepicker_input.rb', line 8

def input
  # Remove defaults that we do not want.
  html_classes.delete(:datepicker)
  html_classes.push(:datetimepicker)

  input_html_classes.push(:datetimepicker_time)
  input_html_options[:type] = "text"

  # Get the input in the correct format.
  input_html_options[:value] = object.send(attribute_name).try(:strftime, Time::DATE_FORMATS[:datetimepicker_time])
  @builder.text_field(attribute_name, input_html_options)
end