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

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

Instance Method Summary (collapse)

Instance Method Details

- (Object) datepicker_format_options(column, format, options)



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

def datepicker_format_options(column, format, options)
  if column.form_ui == :date_picker
    js_format = to_datepicker_format(I18n.translate!("date.formats.#{format}"))
    options['data-dateFormat'] = js_format unless js_format.nil?
  else
    rails_time_format = I18n.translate!("time.formats.#{format}")
    date_format, time_format = datepicker_split_datetime_format(self.to_datepicker_format(rails_time_format))
    options['data-dateFormat'] = date_format unless date_format.nil?
    unless time_format.nil?
      options['data-timeFormat'] = time_format
      options['data-ampm'] = true if rails_time_format.include?('%I')
    end
  end unless format == :default
end

- (Object) datepicker_split_datetime_format(datetime_format)



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

def datepicker_split_datetime_format(datetime_format)
  ActiveScaffold::Bridges::DatePicker::Helper.split_datetime_format(datetime_format)
end

- (Object) to_datepicker_format(rails_format)



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