Class: DatePickerInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Defined in:
app/inputs/date_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_picker_input.rb', line 2

def input_html_options
  value = object.send(attribute_name)
  options = {
    value: value.respond_to?(:to_date) ? I18n.localize(value.to_date, format: :date_picker) : nil,
    data: {
      behaviour: 'date_picker',
      'date-format':  I18n.t('date.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