breadcrumble 4.2.1 → 4.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.tachikoma.yml +1 -0
- data/README.md +2 -1
- data/app/views/breadcrumble/_breadcrumb.html.erb +5 -4
- data/app/views/breadcrumble/_breadcrumb_trails.html.erb +1 -11
- data/app/views/breadcrumble/data_vocabulary/_breadcrumb.html.erb +13 -0
- data/app/views/breadcrumble/{_breadcrumb_trail.html.erb → data_vocabulary/_breadcrumb_trail.html.erb} +1 -1
- data/app/views/breadcrumble/data_vocabulary/_breadcrumb_trails.html.erb +15 -0
- data/breadcrumble.gemspec +1 -0
- data/lib/breadcrumble/version.rb +1 -1
- data/spec/dummy/app/views/breadcrumble/test/_breadcrumb_trails.html.erb +1 -1
- data/spec/helpers/action_view_spec.rb +49 -24
- data/spec/spec_helper.rb +1 -0
- metadata +20 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e77f2cf672c553b891d442d0266f437f1992a84
|
4
|
+
data.tar.gz: 36d218ec470174d5fdc16352aeab7da88f37ac4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9c045374d02b146030cf57dbf261ee48757a3226ccbb8ced62fa8ff8533bdab799e34c778f2be9d72a34658d5b0872c48b17e6ff2a22423925fe74c746b1089b
|
7
|
+
data.tar.gz: 5d7b5277131d019805ac6bd96ae8625cf5f782107ec1edf573e995042cc96270b575053b984821308253d4da900868a5ba98e78811abe05cb3e46638cd9cf43e
|
data/.tachikoma.yml
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
strategy: 'bundler'
|
data/README.md
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
[![Dependency Status](https://gemnasium.com/ma2gedev/breadcrumble.png)](https://gemnasium.com/ma2gedev/breadcrumble)
|
6
6
|
[![Code Climate](https://codeclimate.com/github/ma2gedev/breadcrumble.png)](https://codeclimate.com/github/ma2gedev/breadcrumble)
|
7
7
|
[![Coverage Status](https://coveralls.io/repos/ma2gedev/breadcrumble/badge.png)](https://coveralls.io/r/ma2gedev/breadcrumble)
|
8
|
+
[![Inline docs](http://inch-ci.org/github/ma2gedev/breadcrumble.svg?branch=master)](http://inch-ci.org/github/ma2gedev/breadcrumble)
|
8
9
|
|
9
10
|
![Breadcrumble Logo](http://ma2gedev.github.io/breadcrumble/images/logo_s.png)
|
10
11
|
logo designed by [@524shoutz_nika](https://twitter.com/524shoutz_nika)
|
@@ -15,7 +16,7 @@ Support rich snippets mark up using microdata format as default.
|
|
15
16
|
|
16
17
|
And also support multiple breadcrumb trails.
|
17
18
|
|
18
|
-
See also about rich snippets -> <
|
19
|
+
See also about rich snippets -> <https://developers.google.com/structured-data/breadcrumbs>
|
19
20
|
|
20
21
|
## Installation
|
21
22
|
|
@@ -1,13 +1,14 @@
|
|
1
|
-
<div>
|
1
|
+
<div itemscope itemtype="http://schema.org/BreadcrumbList">
|
2
2
|
<% breadcrumbs.each_with_index do |crumb, i| %>
|
3
3
|
<%= '>' unless i == 0 %>
|
4
|
-
<span itemscope itemtype="http://
|
5
|
-
<% span_title = content_tag(:span, crumb[:name], itemprop: "
|
4
|
+
<span itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem">
|
5
|
+
<% span_title = content_tag(:span, crumb[:name], itemprop: "name") %>
|
6
6
|
<% if crumb[:url] == nil %>
|
7
7
|
<%= span_title %>
|
8
8
|
<% else %>
|
9
|
-
<%= link_to_unless_current span_title, crumb[:url], itemprop: "
|
9
|
+
<%= link_to_unless_current span_title, crumb[:url], itemprop: "item" %>
|
10
10
|
<% end %>
|
11
|
+
<meta itemprop="position" content="<%= i + 1 %>" />
|
11
12
|
</span>
|
12
13
|
<% end %>
|
13
14
|
</div>
|
@@ -1,15 +1,5 @@
|
|
1
1
|
<div>
|
2
2
|
<% breadcrumb_trails.each do |trail| %>
|
3
|
-
|
4
|
-
<% span_title = content_tag(:span, trail[0][:name], itemprop: "title") %>
|
5
|
-
<% if trail[0][:url] == nil %>
|
6
|
-
<%= span_title %>
|
7
|
-
<% else %>
|
8
|
-
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
|
9
|
-
<% end %>
|
10
|
-
<% if trail.size > 1 %>
|
11
|
-
><%= render partial: 'breadcrumble/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
12
|
-
<% end %>
|
13
|
-
</div>
|
3
|
+
<%= render partial: 'breadcrumble/breadcrumb', locals: { breadcrumbs: trail } %>
|
14
4
|
<% end %>
|
15
5
|
</div>
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<div>
|
2
|
+
<% breadcrumbs.each_with_index do |crumb, i| %>
|
3
|
+
<%= '>' unless i == 0 %>
|
4
|
+
<span itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
|
5
|
+
<% span_title = content_tag(:span, crumb[:name], itemprop: "title") %>
|
6
|
+
<% if crumb[:url] == nil %>
|
7
|
+
<%= span_title %>
|
8
|
+
<% else %>
|
9
|
+
<%= link_to_unless_current span_title, crumb[:url], itemprop: "url" %>
|
10
|
+
<% end %>
|
11
|
+
</span>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
@@ -6,6 +6,6 @@
|
|
6
6
|
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
|
7
7
|
<% end %>
|
8
8
|
<% if trail.size > 1 %>
|
9
|
-
><%= render partial: 'breadcrumble/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
9
|
+
><%= render partial: 'breadcrumble/data_vocabulary/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
10
10
|
<% end %>
|
11
11
|
</span>
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<div>
|
2
|
+
<% breadcrumb_trails.each do |trail| %>
|
3
|
+
<div itemscope itemtype="http://data-vocabulary.org/Breadcrumb">
|
4
|
+
<% span_title = content_tag(:span, trail[0][:name], itemprop: "title") %>
|
5
|
+
<% if trail[0][:url] == nil %>
|
6
|
+
<%= span_title %>
|
7
|
+
<% else %>
|
8
|
+
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
|
9
|
+
<% end %>
|
10
|
+
<% if trail.size > 1 %>
|
11
|
+
><%= render partial: 'breadcrumble/data_vocabulary/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
12
|
+
<% end %>
|
13
|
+
</div>
|
14
|
+
<% end %>
|
15
|
+
</div>
|
data/breadcrumble.gemspec
CHANGED
@@ -18,5 +18,6 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.add_dependency "rails", ['>= 4.0.0']
|
19
19
|
gem.add_development_dependency "sqlite3"
|
20
20
|
gem.add_development_dependency "rspec-rails", '~> 3.0'
|
21
|
+
gem.add_development_dependency "rr"
|
21
22
|
gem.add_development_dependency "coveralls"
|
22
23
|
end
|
data/lib/breadcrumble/version.rb
CHANGED
@@ -9,7 +9,7 @@ test breadcrumb_trails theme
|
|
9
9
|
<%= link_to_unless_current span_title, trail[0][:url], itemprop: "url" %>
|
10
10
|
<% end %>
|
11
11
|
<% if trail.size > 1 %>
|
12
|
-
><%= render partial: 'breadcrumble/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
12
|
+
><%= render partial: 'breadcrumble/test/breadcrumb_trail', locals: { trail: trail.drop(1) } %>
|
13
13
|
<% end %>
|
14
14
|
</div>
|
15
15
|
<% end %>
|
@@ -3,21 +3,31 @@ require 'spec_helper'
|
|
3
3
|
describe 'Breadcrumble::ActionView' do
|
4
4
|
context '#render_breadcrumbs' do
|
5
5
|
before do
|
6
|
-
|
6
|
+
stub(helper).breadcrumbs {[
|
7
7
|
{ name: 'root_name', url: '/root_url' },
|
8
8
|
{ name: 'test_name', url: '/test_url' }
|
9
|
-
]
|
9
|
+
]}
|
10
|
+
end
|
11
|
+
context 'schema.org' do
|
12
|
+
subject { helper.render_breadcrumbs }
|
13
|
+
it { is_expected.to match('root_name') }
|
14
|
+
it { is_expected.to match('root_url') }
|
15
|
+
it { is_expected.to match('test_name') }
|
16
|
+
it { is_expected.to match('test_url') }
|
17
|
+
it { is_expected.to match(' itemscope ') }
|
18
|
+
end
|
19
|
+
context 'data-vocabulary.org' do
|
20
|
+
subject { helper.render_breadcrumbs(theme: 'data_vocabulary') }
|
21
|
+
it { is_expected.to match('root_name') }
|
22
|
+
it { is_expected.to match('root_url') }
|
23
|
+
it { is_expected.to match('test_name') }
|
24
|
+
it { is_expected.to match('test_url') }
|
25
|
+
it { is_expected.to match(' itemscope ') }
|
10
26
|
end
|
11
|
-
subject { helper.render_breadcrumbs }
|
12
|
-
it { is_expected.to match('root_name') }
|
13
|
-
it { is_expected.to match('root_url') }
|
14
|
-
it { is_expected.to match('test_name') }
|
15
|
-
it { is_expected.to match('test_url') }
|
16
|
-
it { is_expected.to match(' itemscope ') }
|
17
27
|
end
|
18
28
|
context '#render_breadcrumb_trails' do
|
19
29
|
before do
|
20
|
-
|
30
|
+
stub(helper).breadcrumb_trails {[
|
21
31
|
[
|
22
32
|
{ name: 'trail1_level1', url: '/trail1_level1_url' },
|
23
33
|
{ name: 'trail1_level2', url: '/trail1_level2_url' }
|
@@ -26,25 +36,40 @@ describe 'Breadcrumble::ActionView' do
|
|
26
36
|
{ name: 'trail2_level1', url: '/trail2_level1_url' },
|
27
37
|
{ name: 'trail2_level2', url: '/trail2_level2_url' }
|
28
38
|
]
|
29
|
-
]
|
39
|
+
]}
|
40
|
+
end
|
41
|
+
context 'schema.org' do
|
42
|
+
subject { helper.render_breadcrumb_trails }
|
43
|
+
it { is_expected.to match('trail1_level1') }
|
44
|
+
it { is_expected.to match('trail1_level1_url') }
|
45
|
+
it { is_expected.to match('trail1_level2') }
|
46
|
+
it { is_expected.to match('trail1_level2_url') }
|
47
|
+
it { is_expected.to match('trail2_level1') }
|
48
|
+
it { is_expected.to match('trail2_level1_url') }
|
49
|
+
it { is_expected.to match('trail2_level2') }
|
50
|
+
it { is_expected.to match('trail2_level2_url') }
|
51
|
+
it { is_expected.to match('itemscope itemtype="http://schema.org/BreadcrumbList"') }
|
52
|
+
it { is_expected.to match('itemprop="itemListElement" itemscope itemtype="http://schema.org/ListItem"') }
|
53
|
+
end
|
54
|
+
context 'data-vocabulary.org' do
|
55
|
+
subject { helper.render_breadcrumb_trails(theme: 'data_vocabulary') }
|
56
|
+
it { is_expected.to match('trail1_level1') }
|
57
|
+
it { is_expected.to match('trail1_level1_url') }
|
58
|
+
it { is_expected.to match('trail1_level2') }
|
59
|
+
it { is_expected.to match('trail1_level2_url') }
|
60
|
+
it { is_expected.to match('trail2_level1') }
|
61
|
+
it { is_expected.to match('trail2_level1_url') }
|
62
|
+
it { is_expected.to match('trail2_level2') }
|
63
|
+
it { is_expected.to match('trail2_level2_url') }
|
64
|
+
it { is_expected.to match('itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"') }
|
30
65
|
end
|
31
|
-
subject { helper.render_breadcrumb_trails }
|
32
|
-
it { is_expected.to match('trail1_level1') }
|
33
|
-
it { is_expected.to match('trail1_level1_url') }
|
34
|
-
it { is_expected.to match('trail1_level2') }
|
35
|
-
it { is_expected.to match('trail1_level2_url') }
|
36
|
-
it { is_expected.to match('trail2_level1') }
|
37
|
-
it { is_expected.to match('trail2_level1_url') }
|
38
|
-
it { is_expected.to match('trail2_level2') }
|
39
|
-
it { is_expected.to match('trail2_level2_url') }
|
40
|
-
it { is_expected.to match('itemprop="child" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"') }
|
41
66
|
end
|
42
67
|
context '#render_breadcrumbs with theme' do
|
43
68
|
before do
|
44
|
-
|
69
|
+
stub(helper).breadcrumbs {[
|
45
70
|
{ name: 'root_name', url: '/root_url' },
|
46
71
|
{ name: 'test_name', url: '/test_url' }
|
47
|
-
]
|
72
|
+
]}
|
48
73
|
end
|
49
74
|
subject { helper.render_breadcrumbs(theme: 'test') }
|
50
75
|
it { is_expected.to match('test breadcrumb theme') }
|
@@ -52,7 +77,7 @@ describe 'Breadcrumble::ActionView' do
|
|
52
77
|
end
|
53
78
|
context '#render_breadcrumb_trails with theme' do
|
54
79
|
before do
|
55
|
-
|
80
|
+
stub(helper).breadcrumb_trails {[
|
56
81
|
[
|
57
82
|
{ name: 'trail1_level1', url: '/trail1_level1_url' },
|
58
83
|
{ name: 'trail1_level2', url: '/trail1_level2_url' }
|
@@ -61,7 +86,7 @@ describe 'Breadcrumble::ActionView' do
|
|
61
86
|
{ name: 'trail2_level1', url: '/trail2_level1_url' },
|
62
87
|
{ name: 'trail2_level2', url: '/trail2_level2_url' }
|
63
88
|
]
|
64
|
-
]
|
89
|
+
]}
|
65
90
|
end
|
66
91
|
subject { helper.render_breadcrumb_trails(theme: 'test') }
|
67
92
|
it { is_expected.to match('test breadcrumb_trails theme') }
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breadcrumble
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.
|
4
|
+
version: 4.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ma2ge
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -52,6 +52,20 @@ dependencies:
|
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
55
69
|
- !ruby/object:Gem::Dependency
|
56
70
|
name: coveralls
|
57
71
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,14 +89,17 @@ extra_rdoc_files: []
|
|
75
89
|
files:
|
76
90
|
- ".gitignore"
|
77
91
|
- ".rubocop.yml"
|
92
|
+
- ".tachikoma.yml"
|
78
93
|
- ".travis.yml"
|
79
94
|
- Gemfile
|
80
95
|
- LICENSE
|
81
96
|
- README.md
|
82
97
|
- Rakefile
|
83
98
|
- app/views/breadcrumble/_breadcrumb.html.erb
|
84
|
-
- app/views/breadcrumble/_breadcrumb_trail.html.erb
|
85
99
|
- app/views/breadcrumble/_breadcrumb_trails.html.erb
|
100
|
+
- app/views/breadcrumble/data_vocabulary/_breadcrumb.html.erb
|
101
|
+
- app/views/breadcrumble/data_vocabulary/_breadcrumb_trail.html.erb
|
102
|
+
- app/views/breadcrumble/data_vocabulary/_breadcrumb_trails.html.erb
|
86
103
|
- breadcrumble.gemspec
|
87
104
|
- gemfiles/4.0.gemfile
|
88
105
|
- gemfiles/4.1.gemfile
|