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


143
144
145
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 143

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

#datepicker_format_options(column, format) ⇒ Object


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

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


128
129
130
# File 'lib/active_scaffold/bridges/date_picker/helper.rb', line 128

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