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_name) ⇒ Object



147
148
149
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 147

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

#datepicker_format_options(column, format) ⇒ Object



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

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



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

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