Class: DateTimePickerInput

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

Instance Method Summary collapse

Instance Method Details

#input_html_optionsObject



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

def input_html_options
  value = object.send(attribute_name)
  options = {
    value: value.nil? ? nil : I18n.localize(value, format: :date_picker),
    data: {
      behaviour: 'date_picker',
      'date-format':  I18n.t('time.formats.date_picker_js')
    }
  }
  options[:data][:'side-by-side'] =  @options[:'side_by_side'] || false
  options[:data][:'icon-provider'] = case @options[:icons]
  when :font_awesome
    'fa'
  else
    nil
  end

  super.merge options
end