Module: ActiveScaffold::Bridges::DatePicker::Helper::FormColumnHelpers

Defined in:
lib/active_scaffold/bridges/date_picker/helper.rb

Instance Method Summary collapse

Instance Method Details

#active_scaffold_input_date_picker(column, options, ui_options: column.options) ⇒ Object



171
172
173
174
175
176
177
178
179
180
181
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 171

def active_scaffold_input_date_picker(column, options, ui_options: column.options)
  record = options[:object]
  options = active_scaffold_input_text_options(options.merge(ui_options))
  options[:class] << " #{column.form_ui}"

  format = datepicker_format(options, column.form_ui)
  value = controller.class.condition_value_for_datetime(column, record.send(column.name), column.form_ui == :date_picker ? :to_date : :to_time)
  options[:data] = datepicker_format_options(column, format).reverse_merge!(options[:data] || {})
  options[:value] = (value ? l(value, :format => format) : nil)
  text_field(:record, column.name, options)
end