crummy 1.3.5 → 1.3.6
Sign up to get free protection for your applications and to get access to all the features.
- data/README.textile +3 -1
- data/VERSION +1 -1
- data/lib/crummy/standard_renderer.rb +20 -9
- metadata +19 -38
data/README.textile
CHANGED
@@ -10,7 +10,7 @@ Simply add the dependency to your Gemfile:
|
|
10
10
|
|
11
11
|
<pre>
|
12
12
|
<code>
|
13
|
-
gem "crummy", "~> 1.3.
|
13
|
+
gem "crummy", "~> 1.3.6"
|
14
14
|
</code>
|
15
15
|
</pre>
|
16
16
|
|
@@ -123,5 +123,7 @@ h2. Credits
|
|
123
123
|
* "Kir Shatrov":http://shatrov.tk/
|
124
124
|
* "sugilog":http://github.com/sugilog
|
125
125
|
* "Trond Arve Nordheim":http://github.com/tanordheim
|
126
|
+
* "Jan Szumiec":http://github.com/jasiek
|
127
|
+
* "Jeff Browning":http://github.com/jbrowning
|
126
128
|
|
127
129
|
*Copyright (c) 2008-2011 Zach Inglis, released under the MIT license*
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.3.
|
1
|
+
1.3.6
|
@@ -34,10 +34,13 @@ module Crummy
|
|
34
34
|
options[:separator] = "crumb" if options[:format] == :xml
|
35
35
|
end
|
36
36
|
options[:links] = true if options[:links] == nil
|
37
|
+
options[:first_class] ||= ''
|
38
|
+
options[:last_class] ||= ''
|
39
|
+
|
37
40
|
case options[:format]
|
38
41
|
when :html
|
39
42
|
crumb_string = crumbs.collect do |crumb|
|
40
|
-
crumb_to_html
|
43
|
+
crumb_to_html(crumb, options[:links], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last))
|
41
44
|
end * options[:separator]
|
42
45
|
crumb_string
|
43
46
|
when :html_list
|
@@ -49,13 +52,13 @@ module Crummy
|
|
49
52
|
options[:ul_class] = "" if options[:ul_class] == nil
|
50
53
|
options[:ul_id] = "" if options[:ul_id] == nil
|
51
54
|
crumb_string = crumbs.collect do |crumb|
|
52
|
-
crumb_to_html_list
|
55
|
+
crumb_to_html_list(crumb, options[:links], options[:li_class], options[:active_li_class], options[:first_class], options[:last_class], (crumb == crumbs.first), (crumb == crumbs.last))
|
53
56
|
end * options[:separator]
|
54
57
|
crumb_string = "<ul class=\"#{options[:ul_class]}\" id=\"#{options[:ul_id]}\">" + crumb_string + "</ul>"
|
55
58
|
crumb_string
|
56
59
|
when :xml
|
57
60
|
crumbs.collect do |crumb|
|
58
|
-
crumb_to_xml
|
61
|
+
crumb_to_xml(crumb, options[:links], options[:separator], (crumb == crumbs.first), (crumb == crumbs.last))
|
59
62
|
end * ''
|
60
63
|
else
|
61
64
|
raise ArgumentError, "Unknown breadcrumb output format"
|
@@ -64,17 +67,25 @@ module Crummy
|
|
64
67
|
|
65
68
|
private
|
66
69
|
|
67
|
-
def crumb_to_html(crumb, links)
|
70
|
+
def crumb_to_html(crumb, links, first_class, last_class, is_first, is_last)
|
71
|
+
html_classes = []
|
72
|
+
html_classes << first_class if is_first
|
73
|
+
html_classes << last_class if is_last
|
68
74
|
name, url = crumb
|
69
|
-
url && links ? link_to(name, url) : name
|
75
|
+
url && links ? link_to(name, url, :class => html_classes) : name
|
70
76
|
end
|
71
77
|
|
72
|
-
def crumb_to_html_list(crumb, links, li_class, active_li_class)
|
78
|
+
def crumb_to_html_list(crumb, links, li_class, active_li_class, first_class, last_class, is_first, is_last)
|
73
79
|
name, url = crumb
|
74
|
-
|
80
|
+
html_classes = []
|
81
|
+
html_classes << first_class if is_first
|
82
|
+
html_classes << last_class if is_last
|
83
|
+
html_classes << active_li_class unless url && links
|
84
|
+
html_classes << li_class if !is_first && !is_last && url && links
|
85
|
+
url && links ? "<li class=\"#{html_classes.join(' ').strip}\"><a href=\"#{url}\">#{name}</a></li>" : "<li class=\"#{html_classes.join(' ').strip}\"><span>#{name}</span></li>"
|
75
86
|
end
|
76
|
-
|
77
|
-
def crumb_to_xml(crumb, links, separator)
|
87
|
+
|
88
|
+
def crumb_to_xml(crumb, links, separator, is_first, is_last)
|
78
89
|
name, url = crumb
|
79
90
|
url && links ? "<#{separator} href=\"#{url}\">#{name}</#{separator}>" : "<#{separator}>#{name}</#{separator}>"
|
80
91
|
end
|
metadata
CHANGED
@@ -1,32 +1,23 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: crummy
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.3.6
|
5
5
|
prerelease:
|
6
|
-
segments:
|
7
|
-
- 1
|
8
|
-
- 3
|
9
|
-
- 5
|
10
|
-
version: 1.3.5
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Zach Inglis
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2011-11-04 00:00:00 Z
|
12
|
+
date: 2011-12-24 00:00:00.000000000Z
|
19
13
|
dependencies: []
|
20
|
-
|
21
14
|
description: Crummy is a simple and tasty way to add breadcrumbs to your Rails applications.
|
22
15
|
email: zach+crummy@londonmade.co.uk
|
23
16
|
executables: []
|
24
|
-
|
25
17
|
extensions: []
|
26
|
-
|
27
|
-
extra_rdoc_files:
|
18
|
+
extra_rdoc_files:
|
28
19
|
- README.textile
|
29
|
-
files:
|
20
|
+
files:
|
30
21
|
- .gitignore
|
31
22
|
- MIT-LICENSE
|
32
23
|
- README.textile
|
@@ -41,36 +32,26 @@ files:
|
|
41
32
|
- tasks/crummy_tasks.rake
|
42
33
|
homepage: http://github.com/zachinglis/crummy
|
43
34
|
licenses: []
|
44
|
-
|
45
35
|
post_install_message:
|
46
36
|
rdoc_options: []
|
47
|
-
|
48
|
-
require_paths:
|
37
|
+
require_paths:
|
49
38
|
- lib
|
50
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
39
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
51
40
|
none: false
|
52
|
-
requirements:
|
53
|
-
- -
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
|
56
|
-
|
57
|
-
- 0
|
58
|
-
version: "0"
|
59
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
60
46
|
none: false
|
61
|
-
requirements:
|
62
|
-
- -
|
63
|
-
- !ruby/object:Gem::Version
|
64
|
-
|
65
|
-
segments:
|
66
|
-
- 0
|
67
|
-
version: "0"
|
47
|
+
requirements:
|
48
|
+
- - ! '>='
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '0'
|
68
51
|
requirements: []
|
69
|
-
|
70
52
|
rubyforge_project:
|
71
|
-
rubygems_version: 1.8.
|
53
|
+
rubygems_version: 1.8.8
|
72
54
|
signing_key:
|
73
55
|
specification_version: 3
|
74
56
|
summary: Tasty breadcrumbs!
|
75
57
|
test_files: []
|
76
|
-
|