globalize3_helpers 0.2.5 → 0.3.0
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 +3 -3
- data/lib/helpers/helper.rb +11 -5
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.3.0
|
data/globalize3_helpers.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "globalize3_helpers"
|
8
|
-
s.version = "0.
|
8
|
+
s.version = "0.3.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Lefteris Georgatos"]
|
12
|
-
s.date = "
|
12
|
+
s.date = "2013-03-07"
|
13
13
|
s.description = "Use globalize3 helpers in your views. Forked from https://github.com/fidel/batch_translations "
|
14
14
|
s.email = "lefteris.georgatos@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -29,7 +29,7 @@ Gem::Specification.new do |s|
|
|
29
29
|
s.homepage = "http://github.com/ryudo1987/globalize3_helpers"
|
30
30
|
s.licenses = ["MIT"]
|
31
31
|
s.require_paths = ["lib"]
|
32
|
-
s.rubygems_version = "1.8.
|
32
|
+
s.rubygems_version = "1.8.25"
|
33
33
|
s.summary = "This is the batch translation plugin for globalize3"
|
34
34
|
|
35
35
|
if s.respond_to? :specification_version then
|
data/lib/helpers/helper.rb
CHANGED
@@ -1,8 +1,13 @@
|
|
1
1
|
module ActionView::Helpers
|
2
2
|
class FormBuilder
|
3
|
-
|
3
|
+
|
4
|
+
def locale
|
5
|
+
@@active_locale
|
6
|
+
end
|
7
|
+
|
4
8
|
def globalize_fields_for_locale(locale, *args, &proc)
|
5
9
|
raise ArgumentError, "Missing block" unless block_given?
|
10
|
+
@@active_locale = locale
|
6
11
|
@index = @index ? @index + 1 : 1
|
7
12
|
object_name = "#{@object_name}[translations_attributes][#{@index}]"
|
8
13
|
object = @object.translations.find_by_locale(locale.to_s) || @object.translations.new(:locale => locale)
|
@@ -26,20 +31,21 @@ module ActionView::Helpers
|
|
26
31
|
index = options[:child_index] || "#{self.object.class.to_s}-#{self.object.object_id}"
|
27
32
|
linker = ActiveSupport::SafeBuffer.new
|
28
33
|
fields = ActiveSupport::SafeBuffer.new
|
29
|
-
|
34
|
+
|
30
35
|
::I18n.available_locales.each do |locale|
|
31
36
|
active_class = ::I18n.locale == locale ? "in active" : ""
|
37
|
+
url = "lang-#{locale}-#{index}"
|
32
38
|
linker << self.template.content_tag(:li,
|
33
39
|
self.template.content_tag(:a,
|
34
40
|
::I18n.t("translation.#{locale}"),
|
35
|
-
:href => "
|
41
|
+
:href => "##{url}",
|
36
42
|
:"data-toggle" => "tab"
|
37
43
|
),
|
38
44
|
class: "#{active_class}",
|
39
45
|
)
|
40
46
|
fields << self.template.content_tag(:div,
|
41
47
|
self.semantic_fields_for(*(args.dup << self.object.translation_for(locale)), &proc),
|
42
|
-
:id => "
|
48
|
+
:id => "#{url}",
|
43
49
|
class: "tab-pane fade #{active_class}"
|
44
50
|
)
|
45
51
|
end
|
@@ -54,4 +60,4 @@ module ActionView::Helpers
|
|
54
60
|
)
|
55
61
|
end
|
56
62
|
end
|
57
|
-
end
|
63
|
+
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.
|
4
|
+
version: 0.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-03-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -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: -1971687435279486950
|
158
158
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
159
159
|
none: false
|
160
160
|
requirements:
|
@@ -163,7 +163,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
163
163
|
version: '0'
|
164
164
|
requirements: []
|
165
165
|
rubyforge_project:
|
166
|
-
rubygems_version: 1.8.
|
166
|
+
rubygems_version: 1.8.25
|
167
167
|
signing_key:
|
168
168
|
specification_version: 3
|
169
169
|
summary: This is the batch translation plugin for globalize3
|