globalize3_helpers 0.2.4 → 0.2.5

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.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.4
1
+ 0.2.5
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "globalize3_helpers"
8
- s.version = "0.2.4"
8
+ s.version = "0.2.5"
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 = "2012-10-06"
12
+ s.date = "2012-11-03"
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 = [
@@ -20,6 +20,38 @@ module ActionView::Helpers
20
20
  globalize_fields_for_locale(locale, *args, &proc)
21
21
  end
22
22
  end
23
-
23
+
24
+ # Added "globalize_inputs" that uses standard Twitter Bootstrap tabs.
25
+ def globalize_inputs(*args, &proc)
26
+ index = options[:child_index] || "#{self.object.class.to_s}-#{self.object.object_id}"
27
+ linker = ActiveSupport::SafeBuffer.new
28
+ fields = ActiveSupport::SafeBuffer.new
29
+
30
+ ::I18n.available_locales.each do |locale|
31
+ active_class = ::I18n.locale == locale ? "in active" : ""
32
+ linker << self.template.content_tag(:li,
33
+ self.template.content_tag(:a,
34
+ ::I18n.t("translation.#{locale}"),
35
+ :href => "#lang-#{locale}",
36
+ :"data-toggle" => "tab"
37
+ ),
38
+ class: "#{active_class}",
39
+ )
40
+ fields << self.template.content_tag(:div,
41
+ self.semantic_fields_for(*(args.dup << self.object.translation_for(locale)), &proc),
42
+ :id => "lang-#{locale}",
43
+ class: "tab-pane fade #{active_class}"
44
+ )
45
+ end
46
+
47
+ linker = self.template.content_tag(:ul, linker, class: "nav nav-tabs language-selection")
48
+ fields = self.template.content_tag(:div, fields, class: "tab-content")
49
+
50
+ html = self.template.content_tag(:div,
51
+ linker + fields,
52
+ id: "language-tabs-#{index}",
53
+ class: "tabbable tabs-left"
54
+ )
55
+ end
24
56
  end
25
57
  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
4
+ version: 0.2.5
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: 2012-10-06 00:00:00.000000000 Z
12
+ date: 2012-11-03 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: 281599227258860891
157
+ hash: -3418547762803706170
158
158
  required_rubygems_version: !ruby/object:Gem::Requirement
159
159
  none: false
160
160
  requirements: