localized_fields 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore CHANGED
@@ -14,3 +14,4 @@ spec/reports
14
14
  test/tmp
15
15
  test/version_tmp
16
16
  tmp
17
+ Gemfile.lock
@@ -1,7 +1,8 @@
1
1
  rvm:
2
- - 1.8.7
3
2
  - 1.9.2
4
3
  - 1.9.3
5
4
  - ruby-head
6
- - ree
7
- - rbx-18mode
5
+
6
+ gemfile:
7
+ - gemfiles/mongoid-2.4.gemfile
8
+ - gemfiles/mongoid-3.0.gemfile
@@ -1,15 +1,25 @@
1
- ## 0.1.0 (2012-01-15)
1
+ ## 0.2.0 - June 15, 2012
2
+
3
+ ### Improvements
4
+
5
+ * Adding support to Mongoid 3.
6
+
7
+ ### Major Changes (Backwards Incompatible)
8
+
9
+ * LocalizedFields no longer supports Ruby 1.8.7.
10
+
11
+ ## 0.1.0 - January 15, 2012
2
12
 
3
13
  ### Improvements
4
14
 
5
15
  * Adding support to options on helpers.
6
16
 
7
- ## 0.0.2 (2012-01-06)
17
+ ## 0.0.2 - January 06, 2012
8
18
 
9
19
  ### Bug fixes
10
20
 
11
21
  * The value of the textarea fields were not displayed.
12
22
 
13
- ## 0.0.1 (2012-01-05)
23
+ ## 0.0.1 - January 05, 2012
14
24
 
15
25
  Initial release.
data/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'bson_ext'
4
- gem 'rake'
3
+ gem 'bson_ext', '~> 1.6.1'
4
+ gem 'rake', '~> 0.9.2.2'
5
5
 
6
6
  # Specify your gem's dependencies in localized_fields.gemspec
7
7
  gemspec
data/README.md CHANGED
@@ -72,7 +72,7 @@ end
72
72
 
73
73
  ## Compatibility
74
74
 
75
- Localized Fiedls is tested against Ruby 1.8.7, 1.9.2, 1.9.3, REE and Rubinius.
75
+ Localized Fiedls is tested against Ruby 1.9.2, 1.9.3 and ruby-head.
76
76
 
77
77
  ## Contributing
78
78
 
@@ -0,0 +1,10 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mongoid', '~> 2.4.0'
4
+ gem 'bson_ext', '~> 1.6.1'
5
+
6
+ gem 'rake'
7
+
8
+ gem 'localized_fields', :path => '../'
9
+
10
+ gemspec :path => '../'
@@ -0,0 +1,9 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'mongoid', '~> 3.0.0.rc'
4
+
5
+ gem 'rake'
6
+
7
+ gem 'localized_fields', :path => '../'
8
+
9
+ gemspec :path => '../'
@@ -4,7 +4,7 @@ module LocalizedFields
4
4
  def localized_fields(field = nil, options = {}, &block)
5
5
  if field
6
6
  field_name = "#{field}_translations"
7
- object = @object.send(field_name)
7
+ object = @object.send(field_name).try(:empty?) ? nil : @object.send(field_name)
8
8
  name = "#{object_name}[#{field_name}]"
9
9
 
10
10
  @template.fields_for(name, object, options.merge(:builder => LocalizedFields::FormBuilder), &block).html_safe
@@ -1,3 +1,3 @@
1
1
  module LocalizedFields
2
- VERSION = "0.1.0"
2
+ VERSION = '0.2.0'
3
3
  end
@@ -8,10 +8,10 @@ Gem::Specification.new do |gem|
8
8
  gem.summary = %q{Localized Fields provides form helpers to create forms with localized fields using Mongoid.}
9
9
  gem.homepage = ""
10
10
 
11
- gem.add_dependency 'mongoid', '>= 2.4.0'
12
- gem.add_dependency 'actionpack', '>= 3.1.0'
11
+ gem.add_dependency 'mongoid', '>= 2.4'
12
+ gem.add_dependency 'actionpack', '~> 3.1'
13
13
 
14
- gem.add_development_dependency 'rspec', '~> 2.8.0'
14
+ gem.add_development_dependency 'rspec', '~> 2.8'
15
15
 
16
16
  gem.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
17
17
  gem.files = `git ls-files`.split("\n")
@@ -136,10 +136,11 @@ describe 'LocalizedFields' do
136
136
  describe 'text_area' do
137
137
  it 'should return a text_area tag for en' do
138
138
  output = @builder.localized_fields(:title) do |localized_field|
139
- localized_field.text_area :en
139
+ localized_field.text_area :en, :value => "text"
140
140
  end
141
141
 
142
- expected = '<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20"></textarea>'
142
+ expected = %{<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">\n}
143
+ expected << %{</textarea>}
143
144
 
144
145
  output.should eq(expected)
145
146
  end
@@ -149,8 +150,10 @@ describe 'LocalizedFields' do
149
150
  localized_field.text_area :title
150
151
  end
151
152
 
152
- expected = '<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20"></textarea>' +
153
- '<textarea cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20"></textarea>'
153
+ expected = %{<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">\n}
154
+ expected << %{</textarea>}
155
+ expected << %{<textarea cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20">\n}
156
+ expected << %{</textarea>}
154
157
 
155
158
  output.should eq(expected)
156
159
  end
@@ -159,10 +162,12 @@ describe 'LocalizedFields' do
159
162
  output = @builder.localized_fields do |localized_field|
160
163
  localized_field.text_area :title, :class => 'field'
161
164
  end
162
-
163
- expected = '<textarea class="field" cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20"></textarea>' +
164
- '<textarea class="field" cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20"></textarea>'
165
-
165
+
166
+ expected = %{<textarea class="field" cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">\n}
167
+ expected << %{</textarea>}
168
+ expected << %{<textarea class="field" cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20">\n}
169
+ expected << %{</textarea>}
170
+
166
171
  output.should eq(expected)
167
172
  end
168
173
 
@@ -180,7 +185,8 @@ describe 'LocalizedFields' do
180
185
  localized_field.text_area :en
181
186
  end
182
187
 
183
- expected = '<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">title en</textarea>'
188
+ expected = %{<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">\ntitle en}
189
+ expected << %{</textarea>}
184
190
 
185
191
  output.should eq(expected)
186
192
  end
@@ -189,9 +195,11 @@ describe 'LocalizedFields' do
189
195
  output = @builder.localized_fields do |localized_field|
190
196
  localized_field.text_area :title
191
197
  end
192
-
193
- expected = '<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">title en</textarea>' +
194
- '<textarea cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20">title pt</textarea>'
198
+
199
+ expected = %{<textarea cols="40" id="post_title_translations_en" name="post[title_translations][en]" rows="20">\ntitle en}
200
+ expected << %{</textarea>}
201
+ expected << %{<textarea cols="40" id="post_title_translations_pt" name="post[title_translations][pt]" rows="20">\ntitle pt}
202
+ expected << %{</textarea>}
195
203
 
196
204
  output.should eq(expected)
197
205
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: localized_fields
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,41 +9,56 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-01-16 00:00:00.000000000 Z
12
+ date: 2012-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: mongoid
16
- requirement: &2151861200 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: 2.4.0
21
+ version: '2.4'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2151861200
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '2.4'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: actionpack
27
- requirement: &2151859980 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
- - - ! '>='
35
+ - - ~>
31
36
  - !ruby/object:Gem::Version
32
- version: 3.1.0
37
+ version: '3.1'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *2151859980
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: '3.1'
36
46
  - !ruby/object:Gem::Dependency
37
47
  name: rspec
38
- requirement: &2151859240 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
39
49
  none: false
40
50
  requirements:
41
51
  - - ~>
42
52
  - !ruby/object:Gem::Version
43
- version: 2.8.0
53
+ version: '2.8'
44
54
  type: :development
45
55
  prerelease: false
46
- version_requirements: *2151859240
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '2.8'
47
62
  description: Helps you to create forms with localized fields using Mongoid.
48
63
  email:
49
64
  - tiagogodinho3@gmail.com
@@ -56,10 +71,11 @@ files:
56
71
  - .travis.yml
57
72
  - CHANGELOG.md
58
73
  - Gemfile
59
- - Gemfile.lock
60
74
  - LICENSE
61
75
  - README.md
62
76
  - Rakefile
77
+ - gemfiles/mongoid-2.4.gemfile
78
+ - gemfiles/mongoid-3.0.gemfile
63
79
  - lib/localized_fields.rb
64
80
  - lib/localized_fields/form_builder.rb
65
81
  - lib/localized_fields/helpers.rb
@@ -81,15 +97,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
81
97
  - - ! '>='
82
98
  - !ruby/object:Gem::Version
83
99
  version: '0'
100
+ segments:
101
+ - 0
102
+ hash: 4016080345825084054
84
103
  required_rubygems_version: !ruby/object:Gem::Requirement
85
104
  none: false
86
105
  requirements:
87
106
  - - ! '>='
88
107
  - !ruby/object:Gem::Version
89
108
  version: '0'
109
+ segments:
110
+ - 0
111
+ hash: 4016080345825084054
90
112
  requirements: []
91
113
  rubyforge_project:
92
- rubygems_version: 1.8.13
114
+ rubygems_version: 1.8.24
93
115
  signing_key:
94
116
  specification_version: 3
95
117
  summary: Localized Fields provides form helpers to create forms with localized fields
@@ -1,73 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- localized_fields (0.1.0)
5
- actionpack (>= 3.1.0)
6
- mongoid (>= 2.4.0)
7
-
8
- GEM
9
- remote: https://rubygems.org/
10
- specs:
11
- actionpack (3.1.3)
12
- activemodel (= 3.1.3)
13
- activesupport (= 3.1.3)
14
- builder (~> 3.0.0)
15
- erubis (~> 2.7.0)
16
- i18n (~> 0.6)
17
- rack (~> 1.3.5)
18
- rack-cache (~> 1.1)
19
- rack-mount (~> 0.8.2)
20
- rack-test (~> 0.6.1)
21
- sprockets (~> 2.0.3)
22
- activemodel (3.1.3)
23
- activesupport (= 3.1.3)
24
- builder (~> 3.0.0)
25
- i18n (~> 0.6)
26
- activesupport (3.1.3)
27
- multi_json (~> 1.0)
28
- bson (1.5.2)
29
- bson_ext (1.5.2)
30
- bson (= 1.5.2)
31
- builder (3.0.0)
32
- diff-lcs (1.1.3)
33
- erubis (2.7.0)
34
- hike (1.2.1)
35
- i18n (0.6.0)
36
- mongo (1.5.2)
37
- bson (= 1.5.2)
38
- mongoid (2.4.1)
39
- activemodel (~> 3.1)
40
- mongo (~> 1.3)
41
- tzinfo (~> 0.3.22)
42
- multi_json (1.0.4)
43
- rack (1.3.6)
44
- rack-cache (1.1)
45
- rack (>= 0.4)
46
- rack-mount (0.8.3)
47
- rack (>= 1.0.0)
48
- rack-test (0.6.1)
49
- rack (>= 1.0)
50
- rake (0.9.2.2)
51
- rspec (2.8.0)
52
- rspec-core (~> 2.8.0)
53
- rspec-expectations (~> 2.8.0)
54
- rspec-mocks (~> 2.8.0)
55
- rspec-core (2.8.0)
56
- rspec-expectations (2.8.0)
57
- diff-lcs (~> 1.1.2)
58
- rspec-mocks (2.8.0)
59
- sprockets (2.0.3)
60
- hike (~> 1.2)
61
- rack (~> 1.0)
62
- tilt (~> 1.1, != 1.3.0)
63
- tilt (1.3.3)
64
- tzinfo (0.3.31)
65
-
66
- PLATFORMS
67
- ruby
68
-
69
- DEPENDENCIES
70
- bson_ext
71
- localized_fields!
72
- rake
73
- rspec (~> 2.8.0)