Class: DatePickerInput

Inherits:
SimpleForm::Inputs::Base
  • Object
show all
Defined in:
app/inputs/date_picker_input.rb

Direct Known Subclasses

DateRangePickerInput

Instance Method Summary collapse

Instance Method Details

#data_attributesObject



9
10
11
12
13
14
15
# File 'app/inputs/date_picker_input.rb', line 9

def data_attributes
  attributes = {}
  attributes.reverse_merge!(
    date_language: I18n.locale,
    date_format: 'dd/mm/yyyy'
  )
end

#icon_tableObject



17
18
19
# File 'app/inputs/date_picker_input.rb', line 17

def icon_table
  template.(:span, '', class: 'fa fa-th')
end

#inputObject



2
3
4
5
6
7
# File 'app/inputs/date_picker_input.rb', line 2

def input
  template.(:div, class: 'input-group') do
    template.concat @builder.text_field(attribute_name, input_html_options)
    template.concat span_table
  end
end

#input_html_optionsObject



21
22
23
# File 'app/inputs/date_picker_input.rb', line 21

def input_html_options
  super.merge(class: 'form-control', readonly: true, data: data_attributes)
end

#span_tableObject



25
26
27
28
29
# File 'app/inputs/date_picker_input.rb', line 25

def span_table
  template.(:span, class: 'input-group-addon') do
    template.concat icon_table
  end
end