Class: DatepickerInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Defined in:
app/inputs/datepicker_input.rb

Instance Method Summary collapse

Instance Method Details

#input(wrapper_options = nil) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/inputs/datepicker_input.rb', line 2

def input(wrapper_options = nil)
  placeholder = options.delete(:placeholder) || 'Click to choose a date'

  input_html_options[:data] ||= {}
  input_html_options[:data][:datepicker] = true
  input_html_options[:data][:blank] = options.delete(:blank)

  if column.type == :datetime
    input_html_options[:data][:timepicker] = true
    input_html_options[:data][:timezone_utc_offset] = Time.zone.now.utc_offset
  end

  input_html_options[:placeholder] = placeholder
  input_html_options[:autocomplete] = 'off'

  super
end