globalize3_helpers 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/globalize3_helpers.gemspec +1 -1
- data/lib/helpers/helper.rb +20 -18
- metadata +2 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
data/globalize3_helpers.gemspec
CHANGED
data/lib/helpers/helper.rb
CHANGED
@@ -1,25 +1,27 @@
|
|
1
|
-
module ActionView::Helpers
|
1
|
+
module ActionView::Helpers
|
2
|
+
class FormBuilder
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
4
|
+
def globalize_fields_for_locale(locale, *args, &proc)
|
5
|
+
raise ArgumentError, "Missing block" unless block_given?
|
6
|
+
@index = @index ? @index + 1 : 1
|
7
|
+
object_name = "#{@object_name}[translations_attributes][#{@index}]"
|
8
|
+
object = @object.translations.find_by_locale(locale.to_s) || @object.translations.new(:locale => locale)
|
9
|
+
@template.concat(@template.hidden_field_tag("#{object_name}[id]", object.id)) unless object.new_record?
|
10
|
+
@template.concat(@template.hidden_field_tag("#{object_name}[locale]", locale))
|
11
|
+
if @template.respond_to? :simple_fields_for
|
12
|
+
@template.concat @template.simple_fields_for(object_name, object, *args, &proc)
|
13
|
+
else
|
14
|
+
@template.concat @template.fields_for(object_name, object, *args, &proc)
|
15
|
+
end
|
14
16
|
end
|
15
|
-
end
|
16
17
|
|
17
|
-
|
18
|
+
alias_method :globalize_fields_for_locale, :globalize_fields_for_locales
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def globalize_fields_for_locales(locales = [], *args, &proc)
|
21
|
+
locales.each do |locale|
|
22
|
+
super(locale, *args, &proc)
|
23
|
+
end
|
22
24
|
end
|
25
|
+
|
23
26
|
end
|
24
|
-
|
25
27
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: globalize3_helpers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -154,7 +154,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
154
154
|
version: '0'
|
155
155
|
segments:
|
156
156
|
- 0
|
157
|
-
hash:
|
157
|
+
hash: 117857083895256392
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
none: false
|
160
160
|
requirements:
|