showcase 0.2.0.rc.3 → 0.2.0.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/showcase/traits/link_to.rb +8 -2
- data/lib/showcase/version.rb +1 -1
- data/spec/traits/link_to_spec.rb +7 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ea7a961ec1b6c1052fad8382dbac298219823089
|
4
|
+
data.tar.gz: 57e69cf51b6380e1f1e400ccfc7476eded417201
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 230965dd32b8151f9ed5f43c72614ad951825f79e1dedea1717300fbb74374b890ae14536d4d9dace620740482b09c972e62d5fbbcf58cae53b1812510288bfc
|
7
|
+
data.tar.gz: 4c07a160bf50ef8ed1cfd512a29c29b6b827722228d3d7ce7469d4766a2de341602ea07bf5af8405f7e4aafc4a1eb9ea15d4a8a7a074ddaf255ce14e2b2b1e35
|
@@ -21,9 +21,15 @@ module Showcase
|
|
21
21
|
define_module_method [name, :link] do |*args, &link_block|
|
22
22
|
config = Helpers::ConfigObject.new(self, &block).to_struct
|
23
23
|
|
24
|
+
options = args.extract_options!.symbolize_keys
|
25
|
+
|
26
|
+
active_class = if options[:active_class]
|
27
|
+
options.delete(:active_class)
|
28
|
+
end
|
29
|
+
|
24
30
|
html_options = HtmlOptions.new(config.html_options)
|
25
|
-
html_options.merge_attrs!(
|
26
|
-
html_options.add_class!(config.active_class || 'active') if config.active
|
31
|
+
html_options.merge_attrs!(options)
|
32
|
+
html_options.add_class!(active_class || config.active_class || 'active') if config.active
|
27
33
|
|
28
34
|
args = Array(config.label) if args.empty? && !link_block
|
29
35
|
h.link_to *args, config.url, html_options.to_h, &link_block
|
data/lib/showcase/version.rb
CHANGED
data/spec/traits/link_to_spec.rb
CHANGED
@@ -81,11 +81,17 @@ module Showcase::Traits
|
|
81
81
|
end
|
82
82
|
end
|
83
83
|
|
84
|
-
context 'if a different CSS class was specified' do
|
84
|
+
context 'if a different CSS class was specified at DSL level' do
|
85
85
|
it 'adds it to the link' do
|
86
86
|
expect(subject.foo_link('label')).to have_tag(:a, with: { class: 'current' })
|
87
87
|
end
|
88
88
|
end
|
89
|
+
|
90
|
+
context 'if a different CSS class was specified at method-call level' do
|
91
|
+
it 'adds it to the link' do
|
92
|
+
expect(subject.link('label', active_class: 'current')).to have_tag(:a, with: { class: 'current' })
|
93
|
+
end
|
94
|
+
end
|
89
95
|
end
|
90
96
|
end
|
91
97
|
|