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
21
22
23
24
25
# File 'app/inputs/date_time_picker_input.rb', line 2

def input_html_options
  options = {
    data: {
      behaviour: 'date_picker',
      'date-format':  I18n.t('time.formats.date_picker_js')
    }
  }

  value = if object.respond_to?(attribute_name)
    I18n.localize(object.send(attribute_name), format: :date_picker)
  end

  options[:value] = value if value.present?

  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