showcase 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2793f52eea58c519b380e4a3e87c7ec768d195c1
|
4
|
+
data.tar.gz: c6c9a09255338c9f737fc2cd4ceb6b9213dbc011
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0c4d859554d4c99b6b10078328057d90a51993ea4719f680d4f81bed35ecd0a702629d97bb558cb41a03a54c4a36769bc73c5b988d51ad99a9f98a770d53d133
|
7
|
+
data.tar.gz: ff084a8d82002aab84dfa4ae740736e39808de657f8d71c804709679d3518cfa17a172e9d97b2fd5de29c785053f31c8cb5e7681bd05f06b2fbd9ff3439e2917
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'showcase/helpers/first_nonblank'
|
2
|
+
|
1
3
|
module Showcase
|
2
4
|
module Helpers
|
3
5
|
class SeoMetaBuilder
|
@@ -8,7 +10,7 @@ module Showcase
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def title(values, options = {})
|
11
|
-
title =
|
13
|
+
title = FirstNonBlank.find(values)
|
12
14
|
title += options[:title_suffix] if options[:title_suffix]
|
13
15
|
|
14
16
|
context.content_tag(:title, title) <<
|
@@ -57,12 +59,8 @@ module Showcase
|
|
57
59
|
|
58
60
|
private
|
59
61
|
|
60
|
-
def first_nonblank(values)
|
61
|
-
Array(values).find(&:presence)
|
62
|
-
end
|
63
|
-
|
64
62
|
def seo_meta_tags(*args)
|
65
|
-
value =
|
63
|
+
value = FirstNonBlank.find(args.pop)
|
66
64
|
|
67
65
|
return nil unless value.present?
|
68
66
|
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'showcase/helpers/config_object'
|
2
|
+
require 'showcase/helpers/first_nonblank'
|
2
3
|
require 'active_support/core_ext/object/to_query'
|
3
4
|
|
4
5
|
module Showcase
|
@@ -45,7 +46,9 @@ module Showcase
|
|
45
46
|
html_options = meta.html_options || {}
|
46
47
|
params = Hash[
|
47
48
|
settings[:params].map do |param, meta_key|
|
48
|
-
values = [:"#{social}_#{meta_key}", meta_key].map
|
49
|
+
values = [:"#{social}_#{meta_key}", meta_key].map do |key|
|
50
|
+
FirstNonBlank.find(meta.send(key))
|
51
|
+
end
|
49
52
|
[ param, values.find(&:presence) ]
|
50
53
|
end
|
51
54
|
]
|
data/lib/showcase/version.rb
CHANGED
data/spec/traits/seo_spec.rb
CHANGED
@@ -17,16 +17,16 @@ module Showcase::Traits
|
|
17
17
|
end
|
18
18
|
|
19
19
|
seo do |c|
|
20
|
-
c.title = 'foo'
|
21
|
-
c.description 'bar'
|
20
|
+
c.title = ['', 'foo']
|
21
|
+
c.description = ['', 'bar']
|
22
22
|
end
|
23
23
|
end
|
24
24
|
}
|
25
25
|
|
26
26
|
describe '.seo' do
|
27
27
|
let(:expected_options) { { title_suffix: ' - qux' } }
|
28
|
-
let(:expected_description) { 'bar' }
|
29
|
-
let(:expected_title) { 'foo' }
|
28
|
+
let(:expected_description) { ['', 'bar'] }
|
29
|
+
let(:expected_title) { ['', 'foo'] }
|
30
30
|
|
31
31
|
before do
|
32
32
|
Showcase::Helpers::SeoMetaBuilder.stub(:new).with(view).and_return(builder)
|
data/spec/traits/share_spec.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: showcase
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefano Verna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-02-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -103,6 +103,7 @@ files:
|
|
103
103
|
- lib/showcase.rb
|
104
104
|
- lib/showcase/errors.rb
|
105
105
|
- lib/showcase/helpers/config_object.rb
|
106
|
+
- lib/showcase/helpers/first_nonblank.rb
|
106
107
|
- lib/showcase/helpers/html_options.rb
|
107
108
|
- lib/showcase/helpers/module_method_builder.rb
|
108
109
|
- lib/showcase/helpers/present.rb
|