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 +5 -5
- data/CHANGELOG.md +5 -0
- data/lib/show_for/builder.rb +6 -1
- data/lib/show_for/version.rb +1 -1
- data/test/attribute_test.rb +2 -1
- data/test/test_helper.rb +1 -0
- metadata +10 -22
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: aea7b4ba279bafb8faff6a1fab81b861c543f07ccc1b58e81a89df3e5276c6d7
|
|
4
|
+
data.tar.gz: 354714ab71ac16c7b8186f6da767123719e33d3f6f48a6e850772337a3f5b218
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2b7467d671c1e6d7a1552b9fd59b3afa044acc22b58d03a838a120d8a44176a6157ca6dda9af2be428974b2ac405c37f1cb6572ac1938f39a8c11ea27d0d6d99
|
|
7
|
+
data.tar.gz: 2d06bce272464993ab373ef9930257a665e52fadfcb4959b926446eeae1aba2e55bb203da62108c81124d14148c3a7fce69a874b8cd52928fe70aef610eac14d
|
data/CHANGELOG.md
CHANGED
data/lib/show_for/builder.rb
CHANGED
|
@@ -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
|
|
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
|
|
data/lib/show_for/version.rb
CHANGED
data/test/attribute_test.rb
CHANGED
|
@@ -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
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.
|
|
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:
|
|
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.
|
|
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/
|
|
117
|
-
- test/
|
|
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/
|
|
108
|
+
- test/helper_test.rb
|
|
109
|
+
- test/association_test.rb
|
|
110
|
+
- test/generators/show_for_generator_test.rb
|
|
111
|
+
- test/content_test.rb
|