show_for 0.4.0 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/show_for/builder.rb +1 -1
- data/lib/show_for/version.rb +1 -1
- data/test/attribute_test.rb +16 -0
- data/test/builder_test.rb +7 -0
- data/test/label_test.rb +8 -0
- metadata +14 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 295750047c4d153b81e382891597ee1b8ef33732
|
4
|
+
data.tar.gz: 5fe844da0f1f92a7e6f797c5fdfdf3cae55d8de5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7296204065f4a22e30be3fe6bab6139fd4b3194b3dac0d190f1c01d97ed7a369ac0223105bc737d0e3d578be90d963449e980cd78494bcdbc732fa87b6af126c
|
7
|
+
data.tar.gz: 898edbc22a4a8261592f8bf4ba374360321cd82a62303c97f5d76b18fd28e7c28b8297cb3b569fa5aa31b28b928ae937b1b2c964e7b921ccd3cb13d14cc0d929
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## Unreleased
|
2
|
+
|
3
|
+
## 0.5.0
|
4
|
+
|
5
|
+
* Relaxed dependencies to support Rails 5.
|
6
|
+
* Removed support for Rails `3.2` and `4.0` and Ruby `1.9.3` and `2.0.0`.
|
7
|
+
|
8
|
+
### enhancements
|
9
|
+
* Do not generate label/content/wrapper/collection classes when config is set to `nil`.
|
10
|
+
|
1
11
|
## 0.4.0
|
2
12
|
|
3
13
|
### enhancements
|
data/lib/show_for/builder.rb
CHANGED
@@ -67,7 +67,7 @@ module ShowFor
|
|
67
67
|
if tag
|
68
68
|
type_class = ShowFor.send :"#{type}_class"
|
69
69
|
html_options = options.delete(:"#{type}_html") || {}
|
70
|
-
html_options[:class] =
|
70
|
+
html_options[:class] = [type_class, html_options[:class]].compact.presence
|
71
71
|
@template.content_tag(tag, content, html_options)
|
72
72
|
else
|
73
73
|
content
|
data/lib/show_for/version.rb
CHANGED
data/test/attribute_test.rb
CHANGED
@@ -30,6 +30,14 @@ class AttributeTest < ActionView::TestCase
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
+
test "show_for allows collection class to be disabled globally" do
|
34
|
+
swap ShowFor, :collection_tag => :ol, :collection_class => nil do
|
35
|
+
with_attribute_for @user, :scopes
|
36
|
+
assert_select "div.show_for div.wrapper ol"
|
37
|
+
assert_no_select "ol[class]"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
33
41
|
test "show_for allows collection tag to be changed by attribute" do
|
34
42
|
with_attribute_for @user, :scopes, :collection_tag => :ol
|
35
43
|
assert_select "div.show_for div.wrapper ol.collection"
|
@@ -48,6 +56,14 @@ class AttributeTest < ActionView::TestCase
|
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
59
|
+
test "show_for allows content class to be disabled globally" do
|
60
|
+
swap ShowFor, :content_tag => :span, :content_class => nil do
|
61
|
+
with_attribute_for @user, :name
|
62
|
+
assert_select "div.show_for div.wrapper span"
|
63
|
+
assert_no_select "span[class]"
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
51
67
|
test "show_for allows content tag to be changed by attribute" do
|
52
68
|
with_attribute_for @user, :name, :content_tag => :span
|
53
69
|
assert_select "div.show_for div.wrapper span.content"
|
data/test/builder_test.rb
CHANGED
@@ -11,6 +11,13 @@ class BuilderTest < ActionView::TestCase
|
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
14
|
+
test "show_for allows wrapper class to be disabled globally" do
|
15
|
+
swap ShowFor, :wrapper_tag => "li", :wrapper_class => nil do
|
16
|
+
with_attribute_for @user, :name
|
17
|
+
assert_select "div.show_for li[class='user_name']"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
14
21
|
test "show_for attribute wraps each attribute with a label and content" do
|
15
22
|
with_attribute_for @user, :name
|
16
23
|
assert_select "div.show_for div.user_name.wrapper"
|
data/test/label_test.rb
CHANGED
@@ -24,6 +24,14 @@ class LabelTest < ActionView::TestCase
|
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
|
+
test "show_for allows label class to be disabled globally" do
|
28
|
+
swap ShowFor, :label_tag => :span, :label_class => nil do
|
29
|
+
with_attribute_for @user, :name
|
30
|
+
assert_select "div.show_for div.wrapper span"
|
31
|
+
assert_no_select "span[class]"
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
27
35
|
test "show_for allows label to be changed by attribute" do
|
28
36
|
with_attribute_for @user, :name, :label_tag => :span
|
29
37
|
assert_select "div.show_for div.wrapper span.label"
|
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.
|
4
|
+
version: 0.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- José Valim
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-12-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activemodel
|
@@ -16,40 +16,40 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '4.1'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: '5'
|
22
|
+
version: '5.1'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
29
|
+
version: '4.1'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: '5'
|
32
|
+
version: '5.1'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: actionpack
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
37
|
- - ">="
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
39
|
+
version: '4.1'
|
40
40
|
- - "<"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: '5'
|
42
|
+
version: '5.1'
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - ">="
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
49
|
+
version: '4.1'
|
50
50
|
- - "<"
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: '5'
|
52
|
+
version: '5.1'
|
53
53
|
description: Wrap your objects with a helper to easily show them
|
54
54
|
email: contact@plataformatec.com.br
|
55
55
|
executables: []
|
@@ -86,7 +86,8 @@ files:
|
|
86
86
|
- test/test_helper.rb
|
87
87
|
- test/value_test.rb
|
88
88
|
homepage: http://github.com/plataformatec/show_for
|
89
|
-
licenses:
|
89
|
+
licenses:
|
90
|
+
- MIT
|
90
91
|
metadata: {}
|
91
92
|
post_install_message:
|
92
93
|
rdoc_options: []
|
@@ -96,14 +97,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
96
97
|
requirements:
|
97
98
|
- - ">="
|
98
99
|
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
+
version: 2.1.7
|
100
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
102
|
requirements:
|
102
103
|
- - ">="
|
103
104
|
- !ruby/object:Gem::Version
|
104
105
|
version: '0'
|
105
106
|
requirements: []
|
106
|
-
rubyforge_project:
|
107
|
+
rubyforge_project:
|
107
108
|
rubygems_version: 2.4.5
|
108
109
|
signing_key:
|
109
110
|
specification_version: 4
|