Class: DatePickerInput

Inherits:
SimpleForm::Inputs::StringInput
  • Object
show all
Includes:
ActionView::Context, ActionView::Helpers::FormTagHelper
Defined in:
app/inputs/date_picker_input.rb

Instance Method Summary collapse

Instance Method Details

#hintObject



18
19
20
21
22
23
24
25
26
# File 'app/inputs/date_picker_input.rb', line 18

def hint
  options[:hint_html] ||= {}
  options[:hint_html].merge!(id: hint_id, class: 'hidden')
  hint_text = 'Date (format: MM/DD/YYYY)'
  if options[:input_html] && options[:input_html]["disable-future-dates"]
    hint_text << '. You cannot select a future date.'
  end
  hint_text
end

#inputObject



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/inputs/date_picker_input.rb', line 5

def input
  input_html_options[:id] ||= date_id
  input_html_options.reverse_merge!(
    placeholder: "MM/DD/YYYY",
    value: date_value,
    :"aria-describedby" => hint_id
  )

  (:div, class: 'uc-form-field-date') do
    user_agent.mobile? ? input_for_mobile : input_for_desktop
  end
end

#label_html_optionsObject



28
29
30
31
32
# File 'app/inputs/date_picker_input.rb', line 28

def label_html_options
  options[:input_html] ||= {}
  options[:input_html][:id] ||= date_id
  super
end