Module: ActiveScaffold::Bridges::DatePicker::Helper::DatepickerColumnHelpers

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

Instance Method Summary collapse

Instance Method Details

#datepicker_format(options, ui) ⇒ Object



145
146
147
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 145

def datepicker_format(options, ui)
  options.delete(:format) || (ui == :date_picker ? :default : :picker)
end

#datepicker_format_options(column, format) ⇒ Object



134
135
136
137
138
139
140
141
142
143
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 134

def datepicker_format_options(column, format)
  return {} if format == :default
  if column.form_ui == :date_picker
    js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
    js_format.nil? ? {} : {dateFormat: js_format}
  else
    rails_time_format = I18n.translate!("time.formats.#{format}")
    ActiveScaffold::Bridges::DatePicker::Helper.format_to_datetime_picker(rails_time_format)
  end
end

#to_datepicker_format(rails_format) ⇒ Object



130
131
132
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 130

def to_datepicker_format(rails_format)
  ActiveScaffold::Bridges::DatePicker::Helper.to_datepicker_format(rails_format)
end