show_for 0.6.0 → 0.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 849685149b9200330cac3bf79aab628e175a9854
4
- data.tar.gz: 9b1033f129ffa93395889df61fb3dcec87f69395
2
+ SHA256:
3
+ metadata.gz: aea7b4ba279bafb8faff6a1fab81b861c543f07ccc1b58e81a89df3e5276c6d7
4
+ data.tar.gz: 354714ab71ac16c7b8186f6da767123719e33d3f6f48a6e850772337a3f5b218
5
5
  SHA512:
6
- metadata.gz: 01c0d74bfd6aff1140d7a4634b8f24246eb13f5dc2535c66b3690e631df0554c5a6234d9da4dce5264910ce75f9a3a674740c94a631bc1898f0e62f700b6ea12
7
- data.tar.gz: f04ceaa47c07874d88f8f0d910606f33c06c9e3d2a2f14738e2751ff1cab4c27ce274085a35cf5a2c62cb556d9739debde4427016fb7d7a1e24f59a25c66074f
6
+ metadata.gz: 2b7467d671c1e6d7a1552b9fd59b3afa044acc22b58d03a838a120d8a44176a6157ca6dda9af2be428974b2ac405c37f1cb6572ac1938f39a8c11ea27d0d6d99
7
+ data.tar.gz: 2d06bce272464993ab373ef9930257a665e52fadfcb4959b926446eeae1aba2e55bb203da62108c81124d14148c3a7fce69a874b8cd52928fe70aef610eac14d
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 0.6.1
4
+
5
+ * Add support for Rails 5.2.
6
+ * Fix issue causing blank class not being applied to field wrapper when the result of a Proc is empty.
7
+
3
8
  ## 0.6.0
4
9
 
5
10
  * Relaxed dependencies to support Rails 5.1.
@@ -53,7 +53,7 @@ module ShowFor
53
53
 
54
54
  def apply_wrapper_options!(type, options, value)
55
55
  options[:"#{type}_html"] ||= {}
56
- options[:"#{type}_html"][:class] = [options[:"#{type}_html"][:class], ShowFor.blank_content_class].join(' ') if value.blank? && value != false
56
+ options[:"#{type}_html"][:class] = [options[:"#{type}_html"][:class], ShowFor.blank_content_class].join(' ') if is_empty?(value)
57
57
  options
58
58
  end
59
59
 
@@ -84,6 +84,11 @@ module ShowFor
84
84
  def skip_blanks?(value) #:nodoc:
85
85
  ShowFor.skip_blanks && value.blank? && value != false
86
86
  end
87
+
88
+ def is_empty?(value) #:nodoc:
89
+ value = @template.capture(&value) if value.is_a?(Proc)
90
+ value.blank? && value != false
91
+ end
87
92
  end
88
93
  end
89
94
 
@@ -1,3 +1,3 @@
1
1
  module ShowFor
2
- VERSION = "0.6.0".freeze
2
+ VERSION = "0.6.1".freeze
3
3
  end
@@ -224,8 +224,9 @@ class AttributeTest < ActionView::TestCase
224
224
 
225
225
  test "show_for should wrap blank attributes with no_attribute" do
226
226
  swap ShowFor, :blank_content_class => 'no_attribute' do
227
- with_attributes_for @user, :name, :birthday
227
+ with_attributes_for @user, :name, :birthday, :karma
228
228
  assert_select ".wrapper.user_birthday.no_attribute"
229
+ assert_select ".wrapper.user_karma.no_attribute"
229
230
  assert_select ".wrapper.user_name.no_attribute", false
230
231
  end
231
232
  end
data/test/test_helper.rb CHANGED
@@ -35,6 +35,7 @@ class ActionView::TestCase
35
35
  :invalid => false,
36
36
  :scopes => ["admin", "manager", "visitor"],
37
37
  :birthday => nil,
38
+ :karma => Proc.new { nil },
38
39
  :created_at => Time.now,
39
40
  :updated_at => Date.today
40
41
  }.merge(options))
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: show_for
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - José Valim
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-05-15 00:00:00.000000000 Z
11
+ date: 2018-04-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activemodel
@@ -17,9 +17,6 @@ dependencies:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '4.1'
20
- - - "<"
21
- - !ruby/object:Gem::Version
22
- version: '5.2'
23
20
  type: :runtime
24
21
  prerelease: false
25
22
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,9 +24,6 @@ dependencies:
27
24
  - - ">="
28
25
  - !ruby/object:Gem::Version
29
26
  version: '4.1'
30
- - - "<"
31
- - !ruby/object:Gem::Version
32
- version: '5.2'
33
27
  - !ruby/object:Gem::Dependency
34
28
  name: actionpack
35
29
  requirement: !ruby/object:Gem::Requirement
@@ -37,9 +31,6 @@ dependencies:
37
31
  - - ">="
38
32
  - !ruby/object:Gem::Version
39
33
  version: '4.1'
40
- - - "<"
41
- - !ruby/object:Gem::Version
42
- version: '5.2'
43
34
  type: :runtime
44
35
  prerelease: false
45
36
  version_requirements: !ruby/object:Gem::Requirement
@@ -47,9 +38,6 @@ dependencies:
47
38
  - - ">="
48
39
  - !ruby/object:Gem::Version
49
40
  version: '4.1'
50
- - - "<"
51
- - !ruby/object:Gem::Version
52
- version: '5.2'
53
41
  description: Wrap your objects with a helper to easily show them
54
42
  email: contact@plataformatec.com.br
55
43
  executables: []
@@ -105,19 +93,19 @@ required_rubygems_version: !ruby/object:Gem::Requirement
105
93
  version: '0'
106
94
  requirements: []
107
95
  rubyforge_project:
108
- rubygems_version: 2.6.10
96
+ rubygems_version: 2.7.4
109
97
  signing_key:
110
98
  specification_version: 4
111
99
  summary: Wrap your objects with a helper to easily show them
112
100
  test_files:
113
- - test/association_test.rb
114
- - test/attribute_test.rb
115
101
  - test/builder_test.rb
116
- - test/content_test.rb
117
- - test/generators/show_for_generator_test.rb
118
- - test/helper_test.rb
119
- - test/label_test.rb
102
+ - test/attribute_test.rb
103
+ - test/value_test.rb
120
104
  - test/support/misc_helpers.rb
121
105
  - test/support/models.rb
106
+ - test/label_test.rb
122
107
  - test/test_helper.rb
123
- - test/value_test.rb
108
+ - test/helper_test.rb
109
+ - test/association_test.rb
110
+ - test/generators/show_for_generator_test.rb
111
+ - test/content_test.rb