vinted-crummy 1.9.0 → 1.10.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -3
- data/Appraisals +0 -5
- data/README.md +6 -6
- data/lib/crummy.rb +4 -4
- data/lib/crummy/standard_renderer.rb +11 -10
- data/lib/crummy/version.rb +1 -1
- data/test/standard_renderer_test.rb +16 -16
- metadata +1 -2
- data/gemfiles/rails3_2.gemfile +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f8d22d630abd2210a0d1f1c6e49bf152bfcd71a32998117841d31b3262ccd2e
|
4
|
+
data.tar.gz: 2f829061d42f525a6a4e5861f0f8d1ce6183139f35b4abb4136e2ed55acaf436
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc481154dbacc8897d1a0d834302f513c4eb3d794351ba88554a2716af8b7920017ffe242d8a8e062d8705546f53b0685e12edfc615f072f87421b0f47bf5c58
|
7
|
+
data.tar.gz: 406ee2351744fd7c38336051d85c9bd024a8184abe57c81f428aa916c280fbd79af316cab4c2bbdf978ca26619f26124335f4627628a6df6c0bab98a0344afb4
|
data/.travis.yml
CHANGED
data/Appraisals
CHANGED
data/README.md
CHANGED
@@ -116,10 +116,10 @@ skip_if_blank: true
|
|
116
116
|
render_crumbs #=> <a href="/">Home</a> » <a href="/businesses">Businesses</a>
|
117
117
|
render_crumbs separator: ' | ' #=> <a href="/">Home</a> | <a href="/businesses">Businesses</a>
|
118
118
|
render_crumbs format: :xml #=> <crumb href="/">Home</crumb><crumb href="/businesses">Businesses</crumb>
|
119
|
-
render_crumbs format: :html_list #=> <
|
119
|
+
render_crumbs format: :html_list #=> <ul class="" id=""><li class=""><a href="/">Home</a></li><li class=""><a href="/">Businesses</a></li></ul>
|
120
120
|
render_crumbs format: :html_list, :microdata => true
|
121
|
-
#=> <
|
122
|
-
# <a href="/" itemprop="url"><span itemprop="title">Home</span></a></li></
|
121
|
+
#=> <ul class="" id=""><li class="" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb">
|
122
|
+
# <a href="/" itemprop="url"><span itemprop="title">Home</span></a></li></ul>
|
123
123
|
add_crumb support_link, {:right_side => true, :links => "/support", :li_right_class => "pull-right hidden-phone"}
|
124
124
|
#=> <li class="pull-right hidden-phone">
|
125
125
|
#=> <span><a class="glyphicons shield" href="/support">
|
@@ -131,7 +131,7 @@ add_crumb support_link, {:right_side => true, :links => "/support", :li_right_cl
|
|
131
131
|
|
132
132
|
A crumb with a nil argument for the link will output an unlinked crumb.
|
133
133
|
|
134
|
-
With `format: :html_list` you can specify additional `params: :li_class, :
|
134
|
+
With `format: :html_list` you can specify additional `params: :li_class, :ul_class, :ul_id`
|
135
135
|
|
136
136
|
### App-wide configuration
|
137
137
|
|
@@ -164,8 +164,8 @@ Possible parameters for configuration are:
|
|
164
164
|
:html_list_right_separator
|
165
165
|
:first_class
|
166
166
|
:last_class
|
167
|
-
:
|
168
|
-
:
|
167
|
+
:ul_id
|
168
|
+
:ul_class
|
169
169
|
:li_class
|
170
170
|
:li_right_class
|
171
171
|
:microdata
|
data/lib/crummy.rb
CHANGED
@@ -20,8 +20,8 @@ module Crummy
|
|
20
20
|
attr_accessor :html_list_right_separator
|
21
21
|
attr_accessor :first_class
|
22
22
|
attr_accessor :last_class
|
23
|
-
attr_accessor :
|
24
|
-
attr_accessor :
|
23
|
+
attr_accessor :ul_id
|
24
|
+
attr_accessor :ul_class
|
25
25
|
attr_accessor :li_class
|
26
26
|
attr_accessor :microdata
|
27
27
|
attr_accessor :last_crumb_linked
|
@@ -40,8 +40,8 @@ module Crummy
|
|
40
40
|
@links = true
|
41
41
|
@first_class = ''
|
42
42
|
@last_class = ''
|
43
|
-
@
|
44
|
-
@
|
43
|
+
@ul_id = ''
|
44
|
+
@ul_class = ''
|
45
45
|
@li_class = ''
|
46
46
|
@microdata = false
|
47
47
|
@last_crumb_linked = true
|
@@ -20,9 +20,9 @@ module Crummy
|
|
20
20
|
# render_crumbs #=> <a href="/">Home</a> » <a href="/businesses">Businesses</a>
|
21
21
|
# render_crumbs :separator => ' | ' #=> <a href="/">Home</a> | <a href="/businesses">Businesses</a>
|
22
22
|
# render_crumbs :format => :xml #=> <crumb href="/">Home</crumb><crumb href="/businesses">Businesses</crumb>
|
23
|
-
# render_crumbs :format => :html_list #=> <
|
23
|
+
# render_crumbs :format => :html_list #=> <ul class="" id=""><li class=""><a href="/">Home</a></li><li class=""><a href="/">Businesses</a></li></ul>
|
24
24
|
#
|
25
|
-
# With :format => :html_list you can specify additional params: li_class,
|
25
|
+
# With :format => :html_list you can specify additional params: li_class, ul_class, ul_id
|
26
26
|
# The only argument is for the separator text. It does not assume you want spaces on either side so you must specify. Defaults to +»+
|
27
27
|
#
|
28
28
|
# render_crumbs(" . ") #=> <a href="/">Home</a> . <a href="/businesses">Businesses</a>
|
@@ -64,11 +64,11 @@ module Crummy
|
|
64
64
|
when :html_list
|
65
65
|
# Let's set values for special options of html_list format
|
66
66
|
options[:li_class] ||= Crummy.configuration.li_class
|
67
|
-
options[:
|
68
|
-
options[:
|
69
|
-
options[:
|
67
|
+
options[:ul_class] ||= Crummy.configuration.ul_class
|
68
|
+
options[:ul_id] ||= Crummy.configuration.ul_id
|
69
|
+
options[:ul_id] = nil if options[:ul_id].blank?
|
70
70
|
|
71
|
-
crumb_string = crumbs.map{|crumb|local_global.call(crumb, options, :right_side) ? nil :
|
71
|
+
crumb_string = crumbs.map{|crumb|local_global.call(crumb, options, :right_side) ? nil :
|
72
72
|
crumb_to_html_list(crumb,
|
73
73
|
local_global.call(crumb, options, :links),
|
74
74
|
local_global.call(crumb, options, :li_class),
|
@@ -94,10 +94,10 @@ module Crummy
|
|
94
94
|
local_global.call(crumb, options, :last_crumb_linked),
|
95
95
|
local_global.call(crumb, options, :truncate),
|
96
96
|
local_global.call(crumb, options, :right_separator))}.compact.join.html_safe
|
97
|
-
crumb_string = content_tag(:
|
97
|
+
crumb_string = content_tag(:ul,
|
98
98
|
crumb_string+crumb_right_string,
|
99
|
-
:class => options[:
|
100
|
-
:id => options[:
|
99
|
+
:class => options[:ul_class],
|
100
|
+
:id => options[:ul_id])
|
101
101
|
crumb_string
|
102
102
|
when :xml
|
103
103
|
crumbs.collect do |crumb|
|
@@ -154,7 +154,7 @@ module Crummy
|
|
154
154
|
else
|
155
155
|
html_content = can_link ? link_to((truncate.present? ? name.truncate(truncate) : name), url, options[:link_html_options]) : content_tag(:span, (truncate.present? ? name.truncate(truncate) : name))
|
156
156
|
end
|
157
|
-
content_tag(:li, html_content, html_options)+(/<\/li/ =~ separator ?
|
157
|
+
content_tag(:li, html_content, html_options)+(/<\/li/ =~ separator ?
|
158
158
|
separator : content_tag(:li, separator) unless separator.blank? || is_last)
|
159
159
|
end
|
160
160
|
|
@@ -168,3 +168,4 @@ module Crummy
|
|
168
168
|
end
|
169
169
|
end
|
170
170
|
end
|
171
|
+
|
data/lib/crummy/version.rb
CHANGED
@@ -17,52 +17,52 @@ class StandardRendererTest < Test::Unit::TestCase
|
|
17
17
|
renderer = StandardRenderer.new
|
18
18
|
assert_dom_equal('<a href="url" class="first last">name</a>',
|
19
19
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html))
|
20
|
-
assert_equal('<
|
20
|
+
assert_equal('<ul class=""><li class="first last"><a href="url">name</a></li></ul>',
|
21
21
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list))
|
22
22
|
assert_equal('<crumb href="url">name</crumb>',
|
23
23
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :xml))
|
24
24
|
|
25
25
|
assert_dom_equal('<a href="url1" class="first">name1</a> » <a href="url2" class="last">name2</a>',
|
26
26
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html))
|
27
|
-
assert_equal('<
|
27
|
+
assert_equal('<ul class=""><li class="first li_class"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last li_class"><a href="url3">name3</a></li></ul>',
|
28
28
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list))
|
29
|
-
assert_equal('<
|
29
|
+
assert_equal('<ul class=""><li class="first li_class"><a href="url1">name1</a></li><li> / </li><li class="li_class"><a href="url2">name2</a></li><li> / </li><li class="last li_class"><a href="url3">name3</a></li></ul>',
|
30
30
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / "))
|
31
31
|
assert_equal('<crumb href="url1">name1</crumb><crumb href="url2">name2</crumb>',
|
32
32
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml))
|
33
33
|
|
34
34
|
assert_dom_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><a href="url" class="first last" itemprop="url"><span itemprop="title">name</span></a></div>',
|
35
35
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true))
|
36
|
-
assert_equal('<
|
36
|
+
assert_equal('<ul class=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><a itemprop="url" href="url"><span itemprop="title">name</span></a></li></ul>',
|
37
37
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true))
|
38
|
-
assert_equal('<
|
39
|
-
renderer.render_crumbs([['name', 'url']], :format => :html_list, :
|
38
|
+
assert_equal('<ul class="crumbclass" id="crumbid"><li class="liclass"><a href="url">name</a></li></ul>',
|
39
|
+
renderer.render_crumbs([['name', 'url']], :format => :html_list, :ul_id => "crumbid", :ul_class => "crumbclass", :li_class => "liclass"))
|
40
40
|
end
|
41
41
|
|
42
42
|
def test_classes_last_crumb_not_linked
|
43
43
|
renderer = StandardRenderer.new
|
44
44
|
assert_equal('name',
|
45
45
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
|
46
|
-
assert_equal('<
|
46
|
+
assert_equal('<ul class=""><li class="first last"><span>name</span></li></ul>',
|
47
47
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
|
48
48
|
assert_equal('<crumb href="url">name</crumb>',
|
49
49
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false))
|
50
50
|
|
51
51
|
assert_dom_equal('<a href="url1" class="first">name1</a> » name2',
|
52
52
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
|
53
|
-
assert_equal('<
|
53
|
+
assert_equal('<ul class=""><li class="first li_class"><a href="url1">name1</a></li><li class="li_class"><a href="url2">name2</a></li><li class="last li_class"><span>name3</span></li></ul>',
|
54
54
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
|
55
|
-
assert_equal('<
|
55
|
+
assert_equal('<ul class=""><li class="first li_class"><a href="url1">name1</a></li><li> / </li><li class="li_class"><a href="url2">name2</a></li><li> / </li><li class="last li_class"><span>name3</span></li></ul>',
|
56
56
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2'], ['name3', 'url3']], :li_class => "li_class", :first_class => 'first', :last_class => 'last', :format => :html_list, :separator => " / ", :last_crumb_linked => false))
|
57
57
|
assert_equal('<crumb href="url1">name1</crumb><crumb href="url2">name2</crumb>',
|
58
58
|
renderer.render_crumbs([['name1', 'url1'], ['name2', 'url2']], :first_class => 'first', :last_class => 'last', :format => :xml, :last_crumb_linked => false))
|
59
59
|
|
60
60
|
assert_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></div>',
|
61
61
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html, :microdata => true, :last_crumb_linked => false))
|
62
|
-
assert_equal('<
|
62
|
+
assert_equal('<ul class=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></li></ul>',
|
63
63
|
renderer.render_crumbs([['name', 'url']], :first_class => 'first', :last_class => 'last', :format => :html_list, :microdata => true, :last_crumb_linked => false))
|
64
|
-
assert_equal('<
|
65
|
-
renderer.render_crumbs([['name', 'url']], :format => :html_list, :
|
64
|
+
assert_equal('<ul class="crumbclass" id="crumbid"><li class="liclass"><span>name</span></li></ul>',
|
65
|
+
renderer.render_crumbs([['name', 'url']], :format => :html_list, :ul_id => "crumbid", :ul_class => "crumbclass", :li_class => "liclass", :last_crumb_linked => false))
|
66
66
|
end
|
67
67
|
|
68
68
|
def test_input_object_mutation
|
@@ -97,10 +97,10 @@ class StandardRendererTest < Test::Unit::TestCase
|
|
97
97
|
assert_equal('name',
|
98
98
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
|
99
99
|
|
100
|
-
assert_equal('<
|
100
|
+
assert_equal('<ul class=""><li class="first last"><a title="link title" href="url">name</a></li></ul>',
|
101
101
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list))
|
102
102
|
|
103
|
-
assert_equal('<
|
103
|
+
assert_equal('<ul class=""><li class="first last"><span>name</span></li></ul>',
|
104
104
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
|
105
105
|
end
|
106
106
|
|
@@ -116,10 +116,10 @@ class StandardRendererTest < Test::Unit::TestCase
|
|
116
116
|
assert_equal('<div itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></div>',
|
117
117
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html, :last_crumb_linked => false))
|
118
118
|
|
119
|
-
assert_equal('<
|
119
|
+
assert_equal('<ul class=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><a title="link title" itemprop="url" href="url"><span itemprop="title">name</span></a></li></ul>',
|
120
120
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list))
|
121
121
|
|
122
|
-
assert_equal('<
|
122
|
+
assert_equal('<ul class=""><li class="first last" itemscope="itemscope" itemtype="http://data-vocabulary.org/Breadcrumb"><span itemprop="title">name</span></li></ul>',
|
123
123
|
renderer.render_crumbs([['name', 'url', {:link_html_options => {:title => 'link title'}}]], :first_class => 'first', :last_class => 'last', :format => :html_list, :last_crumb_linked => false))
|
124
124
|
end
|
125
125
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vinted-crummy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.10.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Varneckas
|
@@ -163,7 +163,6 @@ files:
|
|
163
163
|
- example/spec/spec_helper.rb
|
164
164
|
- example/vendor/assets/stylesheets/.gitkeep
|
165
165
|
- example/vendor/plugins/.gitkeep
|
166
|
-
- gemfiles/rails3_2.gemfile
|
167
166
|
- gemfiles/rails4_0.gemfile
|
168
167
|
- init.rb
|
169
168
|
- lib/crummy.rb
|