Module ActionView::Helpers::DateHelper
In: vendor/plugins/gettext_localize/lib/gettext_localize_extend.rb
vendor/plugins/gettext_localize/lib/gettext_localize_rails.rb

DateHelper extensions

Methods

External Aliases

select_month -> select_month_nolocale
date_select -> orig_date_select
select_date -> orig_select_date
datetime_select -> orig_datetime_select
select_datetime -> orig_select_datetime

Public Instance methods

modify date_select to insert date order specified on countries.yml file.

[Source]

     # File vendor/plugins/gettext_localize/lib/gettext_localize_rails.rb, line 230
230:       def date_select(object_name, method, options = {})
231:         options.reverse_merge!(GettextLocalize::date_order) unless options.include? :order
232:         orig_date_select(object_name, method, options)  #:order => [:day,:month,:year])# options)
233:       end

modify datetime_select to insert date order specified on countries.yml file.

[Source]

     # File vendor/plugins/gettext_localize/lib/gettext_localize_rails.rb, line 248
248:       def datetime_select(object_name, method, options = {})
249:         if GettextLocalize::date_order.respond_to? :merge
250:           options.reverse_merge!(GettextLocalize::date_order) unless options.include? :order
251:         end
252:         orig_datetime_select(object_name, method, options)
253:       end

modify select_date to apply order specified on countries.yml file.

[Source]

     # File vendor/plugins/gettext_localize/lib/gettext_localize_rails.rb, line 239
239:       def select_date(date = Date.today, options = {})
240:         options.reverse_merge!(GettextLocalize::date_order) unless options.include? :order
241:         orig_select_date(date, options)
242:       end

modify select_datetime to apply order specified on countries.yml file.

[Source]

     # File vendor/plugins/gettext_localize/lib/gettext_localize_rails.rb, line 259
259:       def select_datetime(datetime = Time.now, options = {})
260:         options.reverse_merge!(GettextLocalize::date_order) unless options.include? :order
261:         orig_select_datetime(datetime, options)
262:       end

overwrite to set the monthnames in current locale TODO: Look for a better way to do this

[Source]

     # File vendor/plugins/gettext_localize/lib/gettext_localize_extend.rb, line 172
172:   def select_month(date, options = {})
173:     val = date ? (date.kind_of?(Fixnum) ? date : date.month) : ''
174:     if options[:use_hidden]
175:       hidden_html(options[:field_name] || 'month', val, options)
176:     else
177:       month_options = []
178:       month_names = options[:use_month_names] || (options[:use_short_month] ? GettextLocalize::abbr_monthnames : GettextLocalize::monthnames)
179:       month_names.unshift(nil) if month_names.size < 13
180:       1.upto(12) do |month_number|
181:         month_name = if options[:use_month_numbers]
182:           month_number
183:         elsif options[:add_month_numbers]
184:           month_number.to_s + ' - ' + month_names[month_number]
185:         else
186:           month_names[month_number]
187:         end
188:   
189:         month_options << ((val == month_number) ?
190:           %(<option value="#{month_number}" selected="selected">#{month_name}</option>\n) :
191:           %(<option value="#{month_number}">#{month_name}</option>\n)
192:         )
193:       end
194:       select_html(options[:field_name] || 'month', month_options, options)
195:     end
196:   end

[Validate]