breadcrumbs_on_rails 0.2.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.rdoc +12 -0
- data/LICENSE.rdoc +1 -1
- data/Manifest +5 -8
- data/README.rdoc +53 -34
- data/breadcrumbs_on_rails.gemspec +5 -5
- data/lib/breadcrumbs_on_rails.rb +3 -3
- data/lib/breadcrumbs_on_rails/controller_mixin.rb +1 -1
- data/lib/breadcrumbs_on_rails/version.rb +5 -5
- metadata +37 -25
- data/install.rb +0 -1
- data/tasks/tabs_on_rails_tasks.rake +0 -4
- data/uninstall.rb +0 -1
data/CHANGELOG.rdoc
CHANGED
@@ -1,6 +1,18 @@
|
|
1
1
|
= Changelog
|
2
2
|
|
3
3
|
|
4
|
+
== Release 1.0.1
|
5
|
+
|
6
|
+
* FIXED: Since the removal of rails/init.rb in 7278376ab77651e540e39552384ad9677e32ff7e, Rails fails to load the helpers.
|
7
|
+
|
8
|
+
|
9
|
+
== Release 1.0.0
|
10
|
+
|
11
|
+
* CHANGED: Removed empty install/uninstall hooks and tasks folder.
|
12
|
+
|
13
|
+
* CHANGED: Removed rails/init hook because deprecated in Rails 3.
|
14
|
+
|
15
|
+
|
4
16
|
== Release 0.2.0
|
5
17
|
|
6
18
|
* Releasing the library as open source project.
|
data/LICENSE.rdoc
CHANGED
data/Manifest
CHANGED
@@ -1,19 +1,16 @@
|
|
1
1
|
CHANGELOG.rdoc
|
2
|
+
LICENSE.rdoc
|
3
|
+
Manifest
|
4
|
+
README.rdoc
|
5
|
+
Rakefile
|
2
6
|
init.rb
|
3
|
-
|
7
|
+
lib/breadcrumbs_on_rails.rb
|
4
8
|
lib/breadcrumbs_on_rails/breadcrumbs.rb
|
5
9
|
lib/breadcrumbs_on_rails/controller_mixin.rb
|
6
10
|
lib/breadcrumbs_on_rails/version.rb
|
7
|
-
lib/breadcrumbs_on_rails.rb
|
8
|
-
LICENSE.rdoc
|
9
|
-
Manifest
|
10
11
|
rails/init.rb
|
11
|
-
Rakefile
|
12
|
-
README.rdoc
|
13
|
-
tasks/tabs_on_rails_tasks.rake
|
14
12
|
test/breadcrumbs_on_rails_test.rb
|
15
13
|
test/builder_test.rb
|
16
14
|
test/element_test.rb
|
17
15
|
test/simple_builder_test.rb
|
18
16
|
test/test_helper.rb
|
19
|
-
uninstall.rb
|
data/README.rdoc
CHANGED
@@ -7,7 +7,7 @@ It provides helpers for creating navigation elements with a flexible interface.
|
|
7
7
|
== Requirements
|
8
8
|
|
9
9
|
* Ruby >= 1.8.6
|
10
|
-
* Rails
|
10
|
+
* Rails 2.2.x, 2.3.x or 3.0 (see section Rails 3 below)
|
11
11
|
|
12
12
|
|
13
13
|
== Rails Installation
|
@@ -15,21 +15,30 @@ It provides helpers for creating navigation elements with a flexible interface.
|
|
15
15
|
=== As a Gem
|
16
16
|
|
17
17
|
This is the preferred way to install BreadcrumbsOnRails and the best way if you want install a stable version.
|
18
|
-
The GEM is hosted on {
|
18
|
+
The GEM is hosted on {RubyGems}[http://rubygems.org/gems/breadcrumbs_on_rails].
|
19
19
|
|
20
|
-
$ gem install breadcrumbs_on_rails
|
20
|
+
$ gem install breadcrumbs_on_rails
|
21
21
|
|
22
|
-
|
22
|
+
==== Rails 2.2.x and 2.3.x
|
23
|
+
|
24
|
+
With Rails 2.2.x and 2.3.x, you need to specify the GEM dependency in your <tt>environment.rb</tt> file so that Rails will automatically include the library on startup.
|
23
25
|
|
24
26
|
Rails::Initializer.run do |config|
|
25
27
|
|
26
28
|
# other configurations
|
27
29
|
# ...
|
28
30
|
|
29
|
-
config.gem "breadcrumbs_on_rails"
|
31
|
+
config.gem "breadcrumbs_on_rails"
|
30
32
|
|
31
33
|
end
|
32
34
|
|
35
|
+
==== Rails 3
|
36
|
+
|
37
|
+
With Rails 3, you need to specify the GEM dependency in your <tt>Gemfile</tt> file so that Bundler can resolve, download and install the library.
|
38
|
+
|
39
|
+
gem "breadcrumbs_on_rails"
|
40
|
+
|
41
|
+
|
33
42
|
=== As a Plugin
|
34
43
|
|
35
44
|
This is the preferred way if you want to live on the edge and install a development version.
|
@@ -39,7 +48,7 @@ This is the preferred way if you want to live on the edge and install a developm
|
|
39
48
|
|
40
49
|
== Usage
|
41
50
|
|
42
|
-
|
51
|
+
Creating a breadcrumb navigation menu in your Rails app using BreadcrumbsOnRails is really straightforward.
|
43
52
|
|
44
53
|
In your controller, call <tt>add_breadcrumb</tt> to push a new element on the breadcrumb stack. <tt>add_breadcrumb</tt> requires two arguments: the name of the breadcrumb and the target path.
|
45
54
|
|
@@ -65,7 +74,7 @@ In your view, you can render the breadcrumb menu with the <tt>render_breadcrumbs
|
|
65
74
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
66
75
|
<title>untitled</title>
|
67
76
|
</head>
|
68
|
-
|
77
|
+
|
69
78
|
<body>
|
70
79
|
<%= render_breadcrumbs %>
|
71
80
|
</body>
|
@@ -85,18 +94,17 @@ A breadcrumbs menu is composed by a number of <tt>Element</tt> objects. Each obj
|
|
85
94
|
|
86
95
|
When you call <tt>add_breadcrumb</tt>, the method automatically creates a new <tt>Element</tt> object for you and append it to the breadcrumbs stack. <tt>Element</tt> name and path can be one of the following Ruby types:
|
87
96
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
</ul>
|
97
|
+
* Symbol
|
98
|
+
* Proc
|
99
|
+
* String
|
100
|
+
|
93
101
|
|
94
102
|
==== Symbol
|
95
103
|
|
96
104
|
If the value is a Symbol, the library calls the corresponding method defined in the same context the and sets the <tt>Element</tt> attribute to the returned value.
|
97
105
|
|
98
106
|
class MyController
|
99
|
-
|
107
|
+
|
100
108
|
# The Name is set to the value returned by
|
101
109
|
# the :root_name method.
|
102
110
|
add_breadcrumb :root_name, root_path
|
@@ -113,29 +121,29 @@ If the value is a Symbol, the library calls the corresponding method defined in
|
|
113
121
|
|
114
122
|
If the value is a Proc, the library calls the proc passing the current view context as argument and sets the <tt>Element</tt> attribute to the returned value. This is useful if you want to postpone the execution to get access to some special methods/variables created in your controller action.
|
115
123
|
|
116
|
-
class MyController
|
124
|
+
class MyController
|
117
125
|
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
126
|
+
# The Name is set to the value returned by
|
127
|
+
# the :root_name method.
|
128
|
+
add_breadcrumb Proc.new { |c| c.my_helper_method },
|
129
|
+
root_path
|
122
130
|
|
123
|
-
end
|
131
|
+
end
|
124
132
|
|
125
133
|
==== String
|
126
134
|
|
127
135
|
If the value is a Proc, the library sets the <tt>Element</tt> attribute to the string value.
|
128
136
|
|
129
137
|
class MyController
|
130
|
-
|
138
|
+
|
131
139
|
# The Name is set to the value returned by
|
132
140
|
# the :root_name method.
|
133
141
|
add_breadcrumb "homepage", "http://example.com/"
|
134
|
-
|
142
|
+
|
135
143
|
end
|
136
144
|
|
137
145
|
|
138
|
-
=== Restricting
|
146
|
+
=== Restricting breadcrumb scope
|
139
147
|
|
140
148
|
The <tt>add_breadcrumb</tt> method understands all options you are used to pass to a Rails controller filter.
|
141
149
|
In fact, behind the scenes this method uses a <tt>before_filter</tt> to store the tab in the <tt>@breadcrumbs</tt> variable.
|
@@ -146,10 +154,10 @@ Taking advantage of Rails filter options, you can restrict a tab to a selected g
|
|
146
154
|
add_breadcrumb "admin", admin_path
|
147
155
|
add_breadcrumb "posts, posts_path, :only => %w(index show)
|
148
156
|
end
|
149
|
-
|
157
|
+
|
150
158
|
class ApplicationController < ActionController::Base
|
151
159
|
add_breadcrumb "admin", admin_path, :if => :admin_controller?
|
152
|
-
|
160
|
+
|
153
161
|
def admin_controller?
|
154
162
|
self.class.name =~ /^Admin(::|Controller)/
|
155
163
|
end
|
@@ -168,7 +176,7 @@ For example, if you want to localize your menu, define a new breadcrumbs node in
|
|
168
176
|
first: First
|
169
177
|
second: Second
|
170
178
|
third: Third
|
171
|
-
|
179
|
+
|
172
180
|
# config/locales/it.yml
|
173
181
|
it:
|
174
182
|
breadcrumbs:
|
@@ -184,30 +192,41 @@ In your controller, use the <tt>I18n.t</tt> method.
|
|
184
192
|
add_breadcrumb I18n.t("breadcrumbs.second"), second_path, :only => %w(second)
|
185
193
|
add_breadcrumb I18n.t("breadcrumbs.third"), third_path, :only => %w(third)
|
186
194
|
end
|
187
|
-
|
195
|
+
|
188
196
|
class ApplicationController < ActionController::Base
|
189
197
|
add_breadcrumb I18n.t("breadcrumbs.homepage"), root_path
|
190
198
|
end
|
191
199
|
|
200
|
+
=== Rails 3
|
201
|
+
|
202
|
+
This plugin is "partially" compatible with Rails 3.
|
203
|
+
The first attempt to create an unique release compatible with both Rails 2.x and Rails 3 failed
|
204
|
+
due to some Rails 3 internal changes
|
205
|
+
(see http://github.com/weppos/breadcrumbs_on_rails/commit/b25885ceb293193b6b264177769f003985df3bff).
|
192
206
|
|
193
|
-
|
207
|
+
This version is specifically packaged and tested against Rails 2.3.x,
|
208
|
+
but you can use it in a Rails 3 application by manually including the
|
209
|
+
<tt>BreadcrumbsOnRails::ControllerMixin</tt> mixin in your <tt>ApplicationController</tt>.
|
210
|
+
|
211
|
+
class ApplicationController < ActionController::Base
|
212
|
+
include BreadcrumbsOnRails::ControllerMixin
|
213
|
+
end
|
194
214
|
|
195
|
-
|
196
|
-
For the full documentation, development roadmap and more information please visit the {project page}[http://code.simonecarletti.com/wiki/breadonrails].
|
215
|
+
A Rails 3 version will be available very soon.
|
197
216
|
|
198
217
|
|
199
|
-
==
|
218
|
+
== Author
|
200
219
|
|
201
|
-
|
220
|
+
* {Simone Carletti}[http://www.simonecarletti.com] <weppos@weppos.net>
|
202
221
|
|
203
222
|
|
204
223
|
== Resources
|
205
224
|
|
206
|
-
* {Homepage}[http://
|
207
|
-
* {
|
225
|
+
* {Homepage}[http://github.com/weppos/breadcrumbs_on_rails]
|
226
|
+
* {Bugs & Features}[http://github.com/weppos/breadcrumbs_on_rails/issues]
|
208
227
|
|
209
228
|
|
210
229
|
== License
|
211
230
|
|
212
|
-
Copyright (c) 2009 Simone Carletti, BreadcrumbsOnRails is released under the MIT license.
|
231
|
+
Copyright (c) 2009-2010 Simone Carletti, BreadcrumbsOnRails is released under the MIT license.
|
213
232
|
|
@@ -2,20 +2,20 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{breadcrumbs_on_rails}
|
5
|
-
s.version = "0.
|
5
|
+
s.version = "1.0.1"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Simone Carletti"]
|
9
|
-
s.date = %q{
|
9
|
+
s.date = %q{2010-05-09}
|
10
10
|
s.description = %q{ BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and managing a breadcrumb navigation for a Rails project. It provides helpers for creating navigation elements with a flexible interface.
|
11
11
|
}
|
12
12
|
s.email = %q{weppos@weppos.net}
|
13
|
-
s.extra_rdoc_files = ["CHANGELOG.rdoc", "
|
14
|
-
s.files = ["CHANGELOG.rdoc", "
|
13
|
+
s.extra_rdoc_files = ["CHANGELOG.rdoc", "LICENSE.rdoc", "README.rdoc", "lib/breadcrumbs_on_rails.rb", "lib/breadcrumbs_on_rails/breadcrumbs.rb", "lib/breadcrumbs_on_rails/controller_mixin.rb", "lib/breadcrumbs_on_rails/version.rb"]
|
14
|
+
s.files = ["CHANGELOG.rdoc", "LICENSE.rdoc", "Manifest", "README.rdoc", "Rakefile", "init.rb", "lib/breadcrumbs_on_rails.rb", "lib/breadcrumbs_on_rails/breadcrumbs.rb", "lib/breadcrumbs_on_rails/controller_mixin.rb", "lib/breadcrumbs_on_rails/version.rb", "rails/init.rb", "test/breadcrumbs_on_rails_test.rb", "test/builder_test.rb", "test/element_test.rb", "test/simple_builder_test.rb", "test/test_helper.rb", "breadcrumbs_on_rails.gemspec"]
|
15
15
|
s.homepage = %q{http://code.simonecarletti.com/breadonrails}
|
16
16
|
s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Breadcrumbs_on_rails", "--main", "README.rdoc"]
|
17
17
|
s.require_paths = ["lib"]
|
18
|
-
s.rubygems_version = %q{1.3.
|
18
|
+
s.rubygems_version = %q{1.3.6}
|
19
19
|
s.summary = %q{A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.}
|
20
20
|
s.test_files = ["test/breadcrumbs_on_rails_test.rb", "test/builder_test.rb", "test/element_test.rb", "test/simple_builder_test.rb", "test/test_helper.rb"]
|
21
21
|
|
data/lib/breadcrumbs_on_rails.rb
CHANGED
@@ -17,12 +17,12 @@
|
|
17
17
|
module BreadcrumbsOnRails
|
18
18
|
|
19
19
|
module Version
|
20
|
-
MAJOR =
|
21
|
-
MINOR =
|
22
|
-
PATCH =
|
23
|
-
|
20
|
+
MAJOR = 1
|
21
|
+
MINOR = 0
|
22
|
+
PATCH = 1
|
23
|
+
BUILD = nil
|
24
24
|
|
25
|
-
STRING = [MAJOR, MINOR, PATCH,
|
25
|
+
STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
|
26
26
|
end
|
27
27
|
|
28
28
|
VERSION = Version::STRING
|
metadata
CHANGED
@@ -1,7 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: breadcrumbs_on_rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 1
|
7
|
+
- 0
|
8
|
+
- 1
|
9
|
+
version: 1.0.1
|
5
10
|
platform: ruby
|
6
11
|
authors:
|
7
12
|
- Simone Carletti
|
@@ -9,29 +14,37 @@ autorequire:
|
|
9
14
|
bindir: bin
|
10
15
|
cert_chain: []
|
11
16
|
|
12
|
-
date:
|
17
|
+
date: 2010-05-09 00:00:00 +02:00
|
13
18
|
default_executable:
|
14
19
|
dependencies:
|
15
20
|
- !ruby/object:Gem::Dependency
|
16
21
|
name: rake
|
17
|
-
|
18
|
-
|
19
|
-
version_requirements: !ruby/object:Gem::Requirement
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
20
24
|
requirements:
|
21
25
|
- - ~>
|
22
26
|
- !ruby/object:Gem::Version
|
27
|
+
segments:
|
28
|
+
- 0
|
29
|
+
- 8
|
30
|
+
- 7
|
23
31
|
version: 0.8.7
|
24
|
-
|
32
|
+
type: :development
|
33
|
+
version_requirements: *id001
|
25
34
|
- !ruby/object:Gem::Dependency
|
26
35
|
name: echoe
|
27
|
-
|
28
|
-
|
29
|
-
version_requirements: !ruby/object:Gem::Requirement
|
36
|
+
prerelease: false
|
37
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
30
38
|
requirements:
|
31
39
|
- - ~>
|
32
40
|
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 3
|
43
|
+
- 2
|
44
|
+
- 0
|
33
45
|
version: 3.2.0
|
34
|
-
|
46
|
+
type: :development
|
47
|
+
version_requirements: *id002
|
35
48
|
description: " BreadcrumbsOnRails is a simple Ruby on Rails plugin for creating and managing a breadcrumb navigation for a Rails project. It provides helpers for creating navigation elements with a flexible interface.\n"
|
36
49
|
email: weppos@weppos.net
|
37
50
|
executables: []
|
@@ -40,33 +53,29 @@ extensions: []
|
|
40
53
|
|
41
54
|
extra_rdoc_files:
|
42
55
|
- CHANGELOG.rdoc
|
56
|
+
- LICENSE.rdoc
|
57
|
+
- README.rdoc
|
58
|
+
- lib/breadcrumbs_on_rails.rb
|
43
59
|
- lib/breadcrumbs_on_rails/breadcrumbs.rb
|
44
60
|
- lib/breadcrumbs_on_rails/controller_mixin.rb
|
45
61
|
- lib/breadcrumbs_on_rails/version.rb
|
46
|
-
- lib/breadcrumbs_on_rails.rb
|
47
|
-
- LICENSE.rdoc
|
48
|
-
- README.rdoc
|
49
|
-
- tasks/tabs_on_rails_tasks.rake
|
50
62
|
files:
|
51
63
|
- CHANGELOG.rdoc
|
64
|
+
- LICENSE.rdoc
|
65
|
+
- Manifest
|
66
|
+
- README.rdoc
|
67
|
+
- Rakefile
|
52
68
|
- init.rb
|
53
|
-
-
|
69
|
+
- lib/breadcrumbs_on_rails.rb
|
54
70
|
- lib/breadcrumbs_on_rails/breadcrumbs.rb
|
55
71
|
- lib/breadcrumbs_on_rails/controller_mixin.rb
|
56
72
|
- lib/breadcrumbs_on_rails/version.rb
|
57
|
-
- lib/breadcrumbs_on_rails.rb
|
58
|
-
- LICENSE.rdoc
|
59
|
-
- Manifest
|
60
73
|
- rails/init.rb
|
61
|
-
- Rakefile
|
62
|
-
- README.rdoc
|
63
|
-
- tasks/tabs_on_rails_tasks.rake
|
64
74
|
- test/breadcrumbs_on_rails_test.rb
|
65
75
|
- test/builder_test.rb
|
66
76
|
- test/element_test.rb
|
67
77
|
- test/simple_builder_test.rb
|
68
78
|
- test/test_helper.rb
|
69
|
-
- uninstall.rb
|
70
79
|
- breadcrumbs_on_rails.gemspec
|
71
80
|
has_rdoc: true
|
72
81
|
homepage: http://code.simonecarletti.com/breadonrails
|
@@ -86,18 +95,21 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
86
95
|
requirements:
|
87
96
|
- - ">="
|
88
97
|
- !ruby/object:Gem::Version
|
98
|
+
segments:
|
99
|
+
- 0
|
89
100
|
version: "0"
|
90
|
-
version:
|
91
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
92
102
|
requirements:
|
93
103
|
- - ">="
|
94
104
|
- !ruby/object:Gem::Version
|
105
|
+
segments:
|
106
|
+
- 1
|
107
|
+
- 2
|
95
108
|
version: "1.2"
|
96
|
-
version:
|
97
109
|
requirements: []
|
98
110
|
|
99
111
|
rubyforge_project:
|
100
|
-
rubygems_version: 1.3.
|
112
|
+
rubygems_version: 1.3.6
|
101
113
|
signing_key:
|
102
114
|
specification_version: 3
|
103
115
|
summary: A simple Ruby on Rails plugin for creating and managing a breadcrumb navigation.
|
data/install.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Install hook code here
|
data/uninstall.rb
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
# Uninstall hook code here
|