Class: Formtastic::Inputs::DatePickerInput

Inherits:
StringInput
  • Object
show all
Defined in:
lib/formtastic/date_picker_input.rb

Direct Known Subclasses

DateTimePickerInput

Instance Method Summary collapse

Instance Method Details

#css_classObject



19
20
21
# File 'lib/formtastic/date_picker_input.rb', line 19

def css_class
  "ui-datepicker-input ui-date-picker-input"
end

#formatObject



11
12
13
# File 'lib/formtastic/date_picker_input.rb', line 11

def format
  input_options[:format] || I18n.t('date.formats.date_picker', :default => '%d/%m/%Y')
end

#input_html_optionsObject



23
24
25
26
# File 'lib/formtastic/date_picker_input.rb', line 23

def input_html_options
  new_class = [super[:class], css_class].compact.join(" ")
  super.update(:class => new_class, :value => value)
end

#to_htmlObject



4
5
6
7
8
9
# File 'lib/formtastic/date_picker_input.rb', line 4

def to_html
  input_wrapping do
    label_html <<
      builder.text_field(input_name, input_html_options)
  end
end

#valueObject



15
16
17
# File 'lib/formtastic/date_picker_input.rb', line 15

def value
  input_options[:value] || object.send(method).try(:strftime, format)
end