jerome-localized-frontend 0.1 → 0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,28 @@
1
- module LocalizedFrontend
2
- module DateHelper
3
- def self.included(base)
4
- ActionView::Helpers::DateHelper.class_eval do
5
- def select_month_with_localization(date, options = {}, html_options = {})
6
- val = date ? (date.kind_of?(Fixnum) ? date : date.month) : ''
7
- if options[:use_hidden]
8
- hidden_html(options[:field_name] || 'month', val, options)
9
- else
10
- month_options = []
11
- month_names = options[:use_month_names] || (options[:use_short_month] ? LocalizedFrontend['month_names']['abbreviated']: LocalizedFrontend['month_names']['full'])
12
- month_names.unshift(nil) if month_names.size < 13
13
- 1.upto(12) do |month_number|
14
- month_name = if options[:use_month_numbers]
15
- month_number
16
- elsif options[:add_month_numbers]
17
- month_number.to_s + ' - ' + month_names[month_number]
18
- else
19
- month_names[month_number]
20
- end
21
-
22
- month_options << ((val == month_number) ?
23
- content_tag(:option, month_name, :value => month_number, :selected => "selected") :
24
- content_tag(:option, month_name, :value => month_number)
25
- )
26
- month_options << "\n"
27
- end
28
- select_html(options[:field_name] || 'month', month_options.join, options, html_options)
29
- end
1
+ module ActionView::Helpers::DateHelper
2
+ def select_month(date, options = {}, html_options = {})
3
+ val = date ? (date.kind_of?(Fixnum) ? date : date.month) : ''
4
+ if options[:use_hidden]
5
+ hidden_html(options[:field_name] || 'month', val, options)
6
+ else
7
+ month_options = []
8
+ month_names = options[:use_month_names] || (options[:use_short_month] ? LocalizedFrontend['month_names']['abbreviated']: LocalizedFrontend['month_names']['full'])
9
+ month_names.unshift(nil) if month_names.size < 13
10
+ 1.upto(12) do |month_number|
11
+ month_name = if options[:use_month_numbers]
12
+ month_number
13
+ elsif options[:add_month_numbers]
14
+ month_number.to_s + ' - ' + month_names[month_number]
15
+ else
16
+ month_names[month_number]
30
17
  end
18
+
19
+ month_options << ((val == month_number) ?
20
+ content_tag(:option, month_name, :value => month_number, :selected => "selected") :
21
+ content_tag(:option, month_name, :value => month_number)
22
+ )
23
+ month_options << "\n"
31
24
  end
32
-
33
- ActionView::Helpers::DateHelper.alias_method_chain :select_month, :localization
25
+ select_html(options[:field_name] || 'month', month_options.join, options, html_options)
34
26
  end
35
27
  end
36
28
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jerome-localized-frontend
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.1"
4
+ version: "0.2"
5
5
  platform: ruby
6
6
  authors:
7
7
  - August Lilleaas