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(wrapper_options) ⇒ Object



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

def input(wrapper_options)
  set_html_options
  set_value_html_option

  classes = ["input-group"]

  input_html_options[:data] ||= {}
  input_html_options[:data]["controller"] = "flatpickr"

  picker_options = (options[:picker] || {}).merge!(flatpickr_options)

  picker_options.each do |k, v|
    input_html_options[:data]["flatpickr-#{k}-value"] = v
  end

  input_html_options[:data]["flatpickr-locale-value"] = I18n.locale

  classes.push("input-group-sm") if input_html_options[:class].include? "input-sm"

  # template.content_tag :div, class: classes do
  input = super(wrapper_options) # leave StringInput do the real rendering
  # end
end

#input_html_classesObject



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

def input_html_classes
  super.push '' # 'form-control'
end