breadcrumbs_on_rails 2.0.0 → 2.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +7 -0
- data/CHANGELOG.rdoc +3 -6
- data/Gemfile +3 -0
- data/Gemfile.lock +81 -0
- data/README.rdoc +9 -1
- data/Rakefile +20 -25
- data/breadcrumbs_on_rails.gemspec +13 -14
- data/lib/breadcrumbs_on_rails.rb +3 -11
- data/lib/breadcrumbs_on_rails/breadcrumbs.rb +42 -45
- data/lib/breadcrumbs_on_rails/controller_mixin.rb +8 -17
- data/lib/breadcrumbs_on_rails/railtie.rb +3 -11
- data/lib/breadcrumbs_on_rails/version.rb +4 -12
- data/test/unit/element_test.rb +15 -4
- data/test/unit/simple_builder_test.rb +0 -1
- metadata +60 -63
- data/test/unit/breadcrumbs_on_rails_test.rb +0 -9
data/.gitignore
ADDED
data/CHANGELOG.rdoc
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
|
+
== Release 2.1.0
|
4
|
+
|
5
|
+
* NEW: Element now accepts a Hash of options. The options can be useful to customize the appearance of the element, for example to set a link title or class.
|
3
6
|
|
4
7
|
== Release 2.0.0
|
5
8
|
|
@@ -7,24 +10,20 @@
|
|
7
10
|
|
8
11
|
* CHANGED: Upgraded to Rails 3
|
9
12
|
|
10
|
-
|
11
13
|
== Release 1.0.1
|
12
14
|
|
13
15
|
* FIXED: Since the removal of rails/init.rb in 7278376ab77651e540e39552384ad9677e32ff7e, Rails fails to load the helpers.
|
14
16
|
|
15
|
-
|
16
17
|
== Release 1.0.0
|
17
18
|
|
18
19
|
* CHANGED: Removed empty install/uninstall hooks and tasks folder.
|
19
20
|
|
20
21
|
* CHANGED: Removed rails/init hook because deprecated in Rails 3.
|
21
22
|
|
22
|
-
|
23
23
|
== Release 0.2.0
|
24
24
|
|
25
25
|
* Releasing the library as open source project.
|
26
26
|
|
27
|
-
|
28
27
|
== Release 0.1.1
|
29
28
|
|
30
29
|
* ADDED: documentation file.
|
@@ -33,8 +32,6 @@
|
|
33
32
|
|
34
33
|
* CHANGED: Removed BUILD and STATUS constants. Added Version::ALPHA constant to be used when I need to package prereleases (see RubyGem --prerelease flag).
|
35
34
|
|
36
|
-
|
37
35
|
== Release 0.1.0
|
38
36
|
|
39
37
|
* Initial version
|
40
|
-
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,81 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
breadcrumbs_on_rails (2.1.0)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: http://rubygems.org/
|
8
|
+
specs:
|
9
|
+
abstract (1.0.0)
|
10
|
+
actionmailer (3.0.7)
|
11
|
+
actionpack (= 3.0.7)
|
12
|
+
mail (~> 2.2.15)
|
13
|
+
actionpack (3.0.7)
|
14
|
+
activemodel (= 3.0.7)
|
15
|
+
activesupport (= 3.0.7)
|
16
|
+
builder (~> 2.1.2)
|
17
|
+
erubis (~> 2.6.6)
|
18
|
+
i18n (~> 0.5.0)
|
19
|
+
rack (~> 1.2.1)
|
20
|
+
rack-mount (~> 0.6.14)
|
21
|
+
rack-test (~> 0.5.7)
|
22
|
+
tzinfo (~> 0.3.23)
|
23
|
+
activemodel (3.0.7)
|
24
|
+
activesupport (= 3.0.7)
|
25
|
+
builder (~> 2.1.2)
|
26
|
+
i18n (~> 0.5.0)
|
27
|
+
activerecord (3.0.7)
|
28
|
+
activemodel (= 3.0.7)
|
29
|
+
activesupport (= 3.0.7)
|
30
|
+
arel (~> 2.0.2)
|
31
|
+
tzinfo (~> 0.3.23)
|
32
|
+
activeresource (3.0.7)
|
33
|
+
activemodel (= 3.0.7)
|
34
|
+
activesupport (= 3.0.7)
|
35
|
+
activesupport (3.0.7)
|
36
|
+
arel (2.0.9)
|
37
|
+
builder (2.1.2)
|
38
|
+
erubis (2.6.6)
|
39
|
+
abstract (>= 1.0.0)
|
40
|
+
i18n (0.5.0)
|
41
|
+
mail (2.2.19)
|
42
|
+
activesupport (>= 2.3.6)
|
43
|
+
i18n (>= 0.4.0)
|
44
|
+
mime-types (~> 1.16)
|
45
|
+
treetop (~> 1.4.8)
|
46
|
+
mime-types (1.16)
|
47
|
+
mocha (0.9.12)
|
48
|
+
polyglot (0.3.1)
|
49
|
+
rack (1.2.2)
|
50
|
+
rack-mount (0.6.14)
|
51
|
+
rack (>= 1.0.0)
|
52
|
+
rack-test (0.5.7)
|
53
|
+
rack (>= 1.0)
|
54
|
+
rails (3.0.7)
|
55
|
+
actionmailer (= 3.0.7)
|
56
|
+
actionpack (= 3.0.7)
|
57
|
+
activerecord (= 3.0.7)
|
58
|
+
activeresource (= 3.0.7)
|
59
|
+
activesupport (= 3.0.7)
|
60
|
+
bundler (~> 1.0)
|
61
|
+
railties (= 3.0.7)
|
62
|
+
railties (3.0.7)
|
63
|
+
actionpack (= 3.0.7)
|
64
|
+
activesupport (= 3.0.7)
|
65
|
+
rake (>= 0.8.7)
|
66
|
+
thor (~> 0.14.4)
|
67
|
+
rake (0.8.7)
|
68
|
+
thor (0.14.6)
|
69
|
+
treetop (1.4.9)
|
70
|
+
polyglot (>= 0.3.1)
|
71
|
+
tzinfo (0.3.27)
|
72
|
+
|
73
|
+
PLATFORMS
|
74
|
+
ruby
|
75
|
+
|
76
|
+
DEPENDENCIES
|
77
|
+
breadcrumbs_on_rails!
|
78
|
+
bundler
|
79
|
+
mocha (~> 0.9.10)
|
80
|
+
rails (~> 3.0.0)
|
81
|
+
rake
|
data/README.rdoc
CHANGED
@@ -46,6 +46,14 @@ In your controller, call <tt>add_breadcrumb</tt> to push a new element on the br
|
|
46
46
|
|
47
47
|
end
|
48
48
|
|
49
|
+
The third, optional argument is a Hash of options to customize the breadcrumb link.
|
50
|
+
|
51
|
+
class MyController
|
52
|
+
def index
|
53
|
+
add_breadcrumb "index", index_path, :title => "Back to the Index"
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
In your view, you can render the breadcrumb menu with the <tt>render_breadcrumbs</tt> helper.
|
50
58
|
|
51
59
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
@@ -187,7 +195,7 @@ In your controller, use the <tt>I18n.t</tt> method.
|
|
187
195
|
|
188
196
|
* {Homepage}[http://www.simonecarletti.com/code/breadcrumbs_on_rails]
|
189
197
|
* {Source}[http://github.com/weppos/breadcrumbs_on_rails]
|
190
|
-
* {API Documentation}[http://
|
198
|
+
* {API Documentation}[http://rubydoc.info/gems/breadcrumbs_on_rails]
|
191
199
|
* {Bugs & Features}[http://github.com/weppos/breadcrumbs_on_rails/issues]
|
192
200
|
|
193
201
|
|
data/Rakefile
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
require 'rubygems'
|
2
|
+
require 'rubygems/package_task'
|
2
3
|
require 'bundler'
|
3
4
|
require 'rake/testtask'
|
4
|
-
require '
|
5
|
-
require '
|
5
|
+
require 'yard'
|
6
|
+
require 'yard/rake/yardoc_task'
|
6
7
|
|
7
8
|
$:.unshift(File.dirname(__FILE__) + "/lib")
|
8
9
|
require 'breadcrumbs_on_rails/version'
|
@@ -34,26 +35,18 @@ spec = Gem::Specification.new do |s|
|
|
34
35
|
s.email = "weppos@weppos.net"
|
35
36
|
s.homepage = "http://www.simonecarletti.com/code/breadcrumbs_on_rails"
|
36
37
|
|
37
|
-
# You should probably have a README of some kind. Change the filename
|
38
|
-
# as appropriate
|
39
|
-
s.extra_rdoc_files = Dir.glob("*.rdoc")
|
40
|
-
s.rdoc_options = %w( --main README.rdoc )
|
41
|
-
|
42
38
|
# Add any extra files to include in the gem (like your README)
|
43
|
-
s.files =
|
39
|
+
s.files = `git ls-files`.split("\n")
|
40
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
44
41
|
s.require_paths = %w( lib )
|
45
42
|
|
43
|
+
s.add_development_dependency("rake")
|
46
44
|
s.add_development_dependency("bundler")
|
47
|
-
s.add_development_dependency("hanna")
|
48
45
|
s.add_development_dependency("rails", "~> 3.0.0")
|
49
46
|
s.add_development_dependency("mocha", "~> 0.9.10")
|
50
47
|
end
|
51
48
|
|
52
|
-
|
53
|
-
# .gemspec file, which is useful if something (i.e. GitHub) will
|
54
|
-
# be automatically building a gem for this project. If you're not
|
55
|
-
# using GitHub, edit as appropriate.
|
56
|
-
Rake::GemPackageTask.new(spec) do |pkg|
|
49
|
+
Gem::PackageTask.new(spec) do |pkg|
|
57
50
|
pkg.gem_spec = spec
|
58
51
|
end
|
59
52
|
|
@@ -69,7 +62,7 @@ task :clean => [:clobber] do
|
|
69
62
|
end
|
70
63
|
|
71
64
|
desc "Remove any generated file"
|
72
|
-
task :clobber => [:
|
65
|
+
task :clobber => [:clobber_package]
|
73
66
|
|
74
67
|
desc "Package the library and generates the gemspec"
|
75
68
|
task :package => [:gemspec]
|
@@ -79,19 +72,21 @@ task :package => [:gemspec]
|
|
79
72
|
Rake::TestTask.new do |t|
|
80
73
|
t.libs << "test"
|
81
74
|
t.test_files = FileList["test/**/*_test.rb"]
|
82
|
-
t.verbose =
|
75
|
+
t.verbose = !!ENV["VERBOSE"]
|
76
|
+
t.warning = !!ENV["WARNING"]
|
83
77
|
end
|
84
78
|
|
79
|
+
|
85
80
|
# Generate documentation
|
86
|
-
Rake::
|
87
|
-
|
88
|
-
rd.rdoc_files.include("*.rdoc", "lib/**/*.rb")
|
89
|
-
rd.rdoc_dir = "rdoc"
|
81
|
+
YARD::Rake::YardocTask.new(:yardoc) do |y|
|
82
|
+
y.options = ["--output-dir", "yardoc"]
|
90
83
|
end
|
91
84
|
|
92
|
-
|
93
|
-
desc "
|
94
|
-
task :
|
95
|
-
|
96
|
-
|
85
|
+
namespace :yardoc do
|
86
|
+
desc "Remove YARD products"
|
87
|
+
task :clobber do
|
88
|
+
rm_r "yardoc" rescue nil
|
89
|
+
end
|
97
90
|
end
|
91
|
+
|
92
|
+
task :clobber => "yardoc:clobber"
|
@@ -1,39 +1,38 @@
|
|
1
1
|
# -*- encoding: utf-8 -*-
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
|
-
s.name =
|
5
|
-
s.version = "2.
|
4
|
+
s.name = "breadcrumbs_on_rails"
|
5
|
+
s.version = "2.1.0"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Simone Carletti"]
|
9
|
-
s.date =
|
10
|
-
s.description =
|
11
|
-
s.email =
|
12
|
-
s.
|
13
|
-
s.
|
14
|
-
s.homepage = %q{http://www.simonecarletti.com/code/breadcrumbs_on_rails}
|
15
|
-
s.rdoc_options = ["--main", "README.rdoc"]
|
9
|
+
s.date = "2011-09-20"
|
10
|
+
s.description = "BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and managing a breadcrumb navigation for a Rails project."
|
11
|
+
s.email = "weppos@weppos.net"
|
12
|
+
s.files = [".gitignore", "CHANGELOG.rdoc", "Gemfile", "Gemfile.lock", "LICENSE", "README.rdoc", "Rakefile", "breadcrumbs_on_rails.gemspec", "init.rb", "lib/breadcrumbs_on_rails.rb", "lib/breadcrumbs_on_rails/breadcrumbs.rb", "lib/breadcrumbs_on_rails/controller_mixin.rb", "lib/breadcrumbs_on_rails/railtie.rb", "lib/breadcrumbs_on_rails/version.rb", "test/test_helper.rb", "test/unit/builder_test.rb", "test/unit/element_test.rb", "test/unit/simple_builder_test.rb"]
|
13
|
+
s.homepage = "http://www.simonecarletti.com/code/breadcrumbs_on_rails"
|
16
14
|
s.require_paths = ["lib"]
|
17
|
-
s.rubygems_version =
|
18
|
-
s.summary =
|
15
|
+
s.rubygems_version = "1.8.10"
|
16
|
+
s.summary = "A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation."
|
17
|
+
s.test_files = ["test/test_helper.rb", "test/unit/builder_test.rb", "test/unit/element_test.rb", "test/unit/simple_builder_test.rb"]
|
19
18
|
|
20
19
|
if s.respond_to? :specification_version then
|
21
20
|
s.specification_version = 3
|
22
21
|
|
23
22
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
23
|
+
s.add_development_dependency(%q<rake>, [">= 0"])
|
24
24
|
s.add_development_dependency(%q<bundler>, [">= 0"])
|
25
|
-
s.add_development_dependency(%q<hanna>, [">= 0"])
|
26
25
|
s.add_development_dependency(%q<rails>, ["~> 3.0.0"])
|
27
26
|
s.add_development_dependency(%q<mocha>, ["~> 0.9.10"])
|
28
27
|
else
|
28
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
29
29
|
s.add_dependency(%q<bundler>, [">= 0"])
|
30
|
-
s.add_dependency(%q<hanna>, [">= 0"])
|
31
30
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
32
31
|
s.add_dependency(%q<mocha>, ["~> 0.9.10"])
|
33
32
|
end
|
34
33
|
else
|
34
|
+
s.add_dependency(%q<rake>, [">= 0"])
|
35
35
|
s.add_dependency(%q<bundler>, [">= 0"])
|
36
|
-
s.add_dependency(%q<hanna>, [">= 0"])
|
37
36
|
s.add_dependency(%q<rails>, ["~> 3.0.0"])
|
38
37
|
s.add_dependency(%q<mocha>, ["~> 0.9.10"])
|
39
38
|
end
|
data/lib/breadcrumbs_on_rails.rb
CHANGED
@@ -1,19 +1,11 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Breadcrumbs On Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: BreadcrumbsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
5
|
#
|
6
|
+
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
|
-
|
17
9
|
require 'breadcrumbs_on_rails/controller_mixin'
|
18
10
|
require 'breadcrumbs_on_rails/breadcrumbs'
|
19
11
|
require 'breadcrumbs_on_rails/version'
|
@@ -1,26 +1,15 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Breadcrumbs On Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: BreadcrumbsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
5
|
#
|
6
|
+
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
|
-
|
17
9
|
module BreadcrumbsOnRails
|
18
|
-
|
10
|
+
|
19
11
|
module Breadcrumbs
|
20
12
|
|
21
|
-
#
|
22
|
-
# = Builder
|
23
|
-
#
|
24
13
|
# The Builder class represents the abstract class for any custom Builder.
|
25
14
|
#
|
26
15
|
# To create a custom Builder, just extend this class
|
@@ -33,9 +22,9 @@ module BreadcrumbsOnRails
|
|
33
22
|
# Initializes a new Builder with <tt>context</tt>,
|
34
23
|
# <tt>element</tt> and <tt>options</tt>.
|
35
24
|
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
25
|
+
# @param [ActionView::Base] context The view context.
|
26
|
+
# @param [Array<Element>] elements The collection of Elements.
|
27
|
+
# @param [Hash] options Hash of options to customize the rendering behavior.
|
39
28
|
#
|
40
29
|
def initialize(context, elements, options = {})
|
41
30
|
@context = context
|
@@ -45,7 +34,9 @@ module BreadcrumbsOnRails
|
|
45
34
|
|
46
35
|
# Renders Elements and returns the Breadcrumb navigation for the view.
|
47
36
|
#
|
48
|
-
#
|
37
|
+
# @return [String] The result of the breadcrumb rendering.
|
38
|
+
#
|
39
|
+
# @abstract You must implement this method in your custom Builder.
|
49
40
|
def render
|
50
41
|
raise NotImplementedError
|
51
42
|
end
|
@@ -55,35 +46,31 @@ module BreadcrumbsOnRails
|
|
55
46
|
|
56
47
|
def compute_name(element)
|
57
48
|
case name = element.name
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
49
|
+
when Symbol
|
50
|
+
@context.send(name)
|
51
|
+
when Proc
|
52
|
+
name.call(@context)
|
53
|
+
else
|
54
|
+
name.to_s
|
64
55
|
end
|
65
56
|
end
|
66
57
|
|
67
58
|
def compute_path(element)
|
68
59
|
case path = element.path
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
60
|
+
when Symbol
|
61
|
+
@context.send(path)
|
62
|
+
when Proc
|
63
|
+
path.call(@context)
|
64
|
+
when Hash
|
65
|
+
@context.url_for(path)
|
66
|
+
else
|
67
|
+
path.to_s
|
77
68
|
end
|
78
|
-
|
79
69
|
end
|
80
70
|
|
81
71
|
end
|
82
72
|
|
83
73
|
|
84
|
-
#
|
85
|
-
# = SimpleBuilder
|
86
|
-
#
|
87
74
|
# The SimpleBuilder is the default breadcrumb builder.
|
88
75
|
# It provides basic functionalities to render a breadcrumb navigation.
|
89
76
|
#
|
@@ -100,7 +87,7 @@ module BreadcrumbsOnRails
|
|
100
87
|
end
|
101
88
|
|
102
89
|
def render_element(element)
|
103
|
-
content = @context.link_to_unless_current(compute_name(element), compute_path(element))
|
90
|
+
content = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options)
|
104
91
|
if @options[:tag]
|
105
92
|
@context.content_tag(@options[:tag], content)
|
106
93
|
else
|
@@ -111,19 +98,29 @@ module BreadcrumbsOnRails
|
|
111
98
|
end
|
112
99
|
|
113
100
|
|
114
|
-
# = Element
|
115
|
-
#
|
116
101
|
# Represents a navigation element in the breadcrumb collection.
|
117
102
|
#
|
118
103
|
class Element
|
119
104
|
|
120
|
-
|
105
|
+
# @return [String] The element/link name.
|
106
|
+
attr_accessor :name
|
107
|
+
# @return [String] The element/link URL.
|
108
|
+
attr_accessor :path
|
109
|
+
# @return [Hash] The element/link URL.
|
110
|
+
attr_accessor :options
|
121
111
|
|
122
|
-
|
123
|
-
|
124
|
-
|
112
|
+
# Initializes the Element with given parameters.
|
113
|
+
#
|
114
|
+
# @param [String] name The element/link name.
|
115
|
+
# @param [String] path The element/link URL.
|
116
|
+
# @param [Hash] options The element/link URL.
|
117
|
+
# @return [Element]
|
118
|
+
#
|
119
|
+
def initialize(name, path, options = {})
|
120
|
+
self.name = name
|
121
|
+
self.path = path
|
122
|
+
self.options = options
|
125
123
|
end
|
126
|
-
|
127
124
|
end
|
128
125
|
|
129
126
|
end
|
@@ -1,19 +1,11 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Breadcrumbs On Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: BreadcrumbsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
5
|
#
|
6
|
+
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
|
-
|
17
9
|
module BreadcrumbsOnRails
|
18
10
|
|
19
11
|
module ControllerMixin
|
@@ -59,14 +51,14 @@ module BreadcrumbsOnRails
|
|
59
51
|
|
60
52
|
module ClassMethods
|
61
53
|
|
62
|
-
def add_breadcrumb(name, path,
|
54
|
+
def add_breadcrumb(name, path, filter_options = {})
|
63
55
|
# This isn't really nice here
|
64
|
-
if eval = Utils.convert_to_set_of_strings(
|
56
|
+
if eval = Utils.convert_to_set_of_strings(filter_options.delete(:eval), %w(name path))
|
65
57
|
name = Utils.instance_proc(name) if eval.include?("name")
|
66
58
|
path = Utils.instance_proc(path) if eval.include?("path")
|
67
59
|
end
|
68
60
|
|
69
|
-
before_filter(
|
61
|
+
before_filter(filter_options) do |controller|
|
70
62
|
controller.send(:add_breadcrumb, name, path)
|
71
63
|
end
|
72
64
|
end
|
@@ -76,14 +68,13 @@ module BreadcrumbsOnRails
|
|
76
68
|
module InstanceMethods
|
77
69
|
protected
|
78
70
|
|
79
|
-
def add_breadcrumb(name, path)
|
80
|
-
self.breadcrumbs << Breadcrumbs::Element.new(name, path)
|
71
|
+
def add_breadcrumb(name, path, options = {})
|
72
|
+
self.breadcrumbs << Breadcrumbs::Element.new(name, path, options)
|
81
73
|
end
|
82
74
|
|
83
75
|
def breadcrumbs
|
84
76
|
@breadcrumbs ||= []
|
85
77
|
end
|
86
|
-
|
87
78
|
end
|
88
79
|
|
89
80
|
module HelperMethods
|
@@ -1,19 +1,11 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Breadcrumbs On Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: BreadcrumbsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
5
|
#
|
6
|
+
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
|
-
|
17
9
|
module BreadcrumbsOnRails
|
18
10
|
|
19
11
|
class Railtie < Rails::Railtie
|
@@ -1,24 +1,16 @@
|
|
1
|
-
|
2
|
-
#
|
1
|
+
#--
|
2
|
+
# Breadcrumbs On Rails
|
3
3
|
#
|
4
4
|
# A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
5
|
-
#
|
6
|
-
#
|
7
|
-
# Category:: Rails
|
8
|
-
# Package:: BreadcrumbsOnRails
|
9
|
-
# Author:: Simone Carletti <weppos@weppos.net>
|
10
|
-
# License:: MIT License
|
11
|
-
#
|
12
|
-
#--
|
13
5
|
#
|
6
|
+
# Copyright (c) 2009-2011 Simone Carletti <weppos@weppos.net>
|
14
7
|
#++
|
15
8
|
|
16
|
-
|
17
9
|
module BreadcrumbsOnRails
|
18
10
|
|
19
11
|
module Version
|
20
12
|
MAJOR = 2
|
21
|
-
MINOR =
|
13
|
+
MINOR = 1
|
22
14
|
PATCH = 0
|
23
15
|
BUILD = nil
|
24
16
|
|
data/test/unit/element_test.rb
CHANGED
@@ -9,13 +9,18 @@ class ElementTest < ActiveSupport::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
def test_initialize_should_set_name
|
12
|
-
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(:
|
13
|
-
assert_equal :
|
12
|
+
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(:homepage, nil)
|
13
|
+
assert_equal :homepage, element.name
|
14
14
|
end
|
15
15
|
|
16
16
|
def test_initialize_should_set_path
|
17
|
-
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(nil,
|
18
|
-
assert_equal
|
17
|
+
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(nil, "/")
|
18
|
+
assert_equal "/", element.path
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_initialize_should_allow_options
|
22
|
+
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(:homepage, "/", :title => "Go to the Homepage")
|
23
|
+
assert_equal({ :title => "Go to the Homepage" }, element.options)
|
19
24
|
end
|
20
25
|
|
21
26
|
|
@@ -31,4 +36,10 @@ class ElementTest < ActiveSupport::TestCase
|
|
31
36
|
assert_equal({ :controller => "index", :action => "index" }, element.path)
|
32
37
|
end
|
33
38
|
|
39
|
+
def test_options
|
40
|
+
element = BreadcrumbsOnRails::Breadcrumbs::Element.new(nil, nil)
|
41
|
+
element.options = { :title => "Go to the Homepage" }
|
42
|
+
assert_equal({ :title => "Go to the Homepage" }, element.options)
|
43
|
+
end
|
44
|
+
|
34
45
|
end
|
metadata
CHANGED
@@ -1,114 +1,111 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: breadcrumbs_on_rails
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.1.0
|
4
5
|
prerelease:
|
5
|
-
version: 2.0.0
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Simone Carletti
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
12
|
+
date: 2011-09-20 00:00:00.000000000Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rake
|
16
|
+
requirement: &70277284828980 !ruby/object:Gem::Requirement
|
18
17
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
version:
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
23
22
|
type: :development
|
24
23
|
prerelease: false
|
25
|
-
version_requirements: *
|
26
|
-
- !ruby/object:Gem::Dependency
|
27
|
-
name:
|
28
|
-
requirement: &
|
24
|
+
version_requirements: *70277284828980
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: bundler
|
27
|
+
requirement: &70277284828540 !ruby/object:Gem::Requirement
|
29
28
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
version:
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
34
33
|
type: :development
|
35
34
|
prerelease: false
|
36
|
-
version_requirements: *
|
37
|
-
- !ruby/object:Gem::Dependency
|
35
|
+
version_requirements: *70277284828540
|
36
|
+
- !ruby/object:Gem::Dependency
|
38
37
|
name: rails
|
39
|
-
requirement: &
|
38
|
+
requirement: &70277284827980 !ruby/object:Gem::Requirement
|
40
39
|
none: false
|
41
|
-
requirements:
|
40
|
+
requirements:
|
42
41
|
- - ~>
|
43
|
-
- !ruby/object:Gem::Version
|
42
|
+
- !ruby/object:Gem::Version
|
44
43
|
version: 3.0.0
|
45
44
|
type: :development
|
46
45
|
prerelease: false
|
47
|
-
version_requirements: *
|
48
|
-
- !ruby/object:Gem::Dependency
|
46
|
+
version_requirements: *70277284827980
|
47
|
+
- !ruby/object:Gem::Dependency
|
49
48
|
name: mocha
|
50
|
-
requirement: &
|
49
|
+
requirement: &70277284827500 !ruby/object:Gem::Requirement
|
51
50
|
none: false
|
52
|
-
requirements:
|
51
|
+
requirements:
|
53
52
|
- - ~>
|
54
|
-
- !ruby/object:Gem::Version
|
53
|
+
- !ruby/object:Gem::Version
|
55
54
|
version: 0.9.10
|
56
55
|
type: :development
|
57
56
|
prerelease: false
|
58
|
-
version_requirements: *
|
59
|
-
description: BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and
|
57
|
+
version_requirements: *70277284827500
|
58
|
+
description: BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and
|
59
|
+
managing a breadcrumb navigation for a Rails project.
|
60
60
|
email: weppos@weppos.net
|
61
61
|
executables: []
|
62
|
-
|
63
62
|
extensions: []
|
64
|
-
|
65
|
-
|
63
|
+
extra_rdoc_files: []
|
64
|
+
files:
|
65
|
+
- .gitignore
|
66
66
|
- CHANGELOG.rdoc
|
67
|
-
-
|
68
|
-
|
69
|
-
- Rakefile
|
67
|
+
- Gemfile
|
68
|
+
- Gemfile.lock
|
70
69
|
- LICENSE
|
71
|
-
- init.rb
|
72
|
-
- CHANGELOG.rdoc
|
73
70
|
- README.rdoc
|
71
|
+
- Rakefile
|
74
72
|
- breadcrumbs_on_rails.gemspec
|
73
|
+
- init.rb
|
74
|
+
- lib/breadcrumbs_on_rails.rb
|
75
75
|
- lib/breadcrumbs_on_rails/breadcrumbs.rb
|
76
76
|
- lib/breadcrumbs_on_rails/controller_mixin.rb
|
77
77
|
- lib/breadcrumbs_on_rails/railtie.rb
|
78
78
|
- lib/breadcrumbs_on_rails/version.rb
|
79
|
-
- lib/breadcrumbs_on_rails.rb
|
80
79
|
- test/test_helper.rb
|
81
|
-
- test/unit/breadcrumbs_on_rails_test.rb
|
82
80
|
- test/unit/builder_test.rb
|
83
81
|
- test/unit/element_test.rb
|
84
82
|
- test/unit/simple_builder_test.rb
|
85
83
|
homepage: http://www.simonecarletti.com/code/breadcrumbs_on_rails
|
86
84
|
licenses: []
|
87
|
-
|
88
85
|
post_install_message:
|
89
|
-
rdoc_options:
|
90
|
-
|
91
|
-
- README.rdoc
|
92
|
-
require_paths:
|
86
|
+
rdoc_options: []
|
87
|
+
require_paths:
|
93
88
|
- lib
|
94
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
89
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
95
90
|
none: false
|
96
|
-
requirements:
|
97
|
-
- -
|
98
|
-
- !ruby/object:Gem::Version
|
99
|
-
version:
|
100
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
101
96
|
none: false
|
102
|
-
requirements:
|
103
|
-
- -
|
104
|
-
- !ruby/object:Gem::Version
|
105
|
-
version:
|
97
|
+
requirements:
|
98
|
+
- - ! '>='
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '0'
|
106
101
|
requirements: []
|
107
|
-
|
108
102
|
rubyforge_project:
|
109
|
-
rubygems_version: 1.
|
103
|
+
rubygems_version: 1.8.10
|
110
104
|
signing_key:
|
111
105
|
specification_version: 3
|
112
106
|
summary: A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
113
|
-
test_files:
|
114
|
-
|
107
|
+
test_files:
|
108
|
+
- test/test_helper.rb
|
109
|
+
- test/unit/builder_test.rb
|
110
|
+
- test/unit/element_test.rb
|
111
|
+
- test/unit/simple_builder_test.rb
|