Sha256: 162f240f863a6c4622532a1f9bb38ff1083be8f3ad93c69010225d6392b2fd15
Contents?: true
Size: 643 Bytes
Versions: 16
Compression:
Stored size: 643 Bytes
Contents
class DateFieldInput < SimpleForm::Inputs::StringInput # Normalizes to localized date def date_value value = object.send(attribute_name) return nil unless value.present? value = Date.parse(value) if value.is_a? String I18n.localize(value) end def input input_html_options[:type] = 'text' template.content_tag(:div, :class => 'input-append date-picker date') do @builder.text_field(attribute_name, input_html_options.merge(:value => date_value)) + template.content_tag(:div, :class => 'add-on') do template.content_tag(:i, '', :class => 'icon-calendar') end end end end
Version data entries
16 entries across 16 versions & 1 rubygems