rails_breadcrumbs 0.5.4 → 0.5.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,15 @@
1
+ ---
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ NDM5OWM0YTMxZTc3YWY5ODE1NDlmYmZiYTQ5NWRjMjhlODFiMTY1MQ==
5
+ data.tar.gz: !binary |-
6
+ NzZmMWQwOTJiNzVkZTNmOThiM2Q3Yjg0NGRjYzY3NDU1OTVkZDVkOA==
7
+ SHA512:
8
+ metadata.gz: !binary |-
9
+ ZDc4ZGFjYzU0YmY1ZDBiNWEzYWU5NzkyYmEzMGE0NzVmNTJjMDc0YzE4ZjRi
10
+ MjE3MzY0NDczNDkzMmU5YjllZDY2NjNmMmQ1YTJiOGUxNWZlZGJlMWQzOGJj
11
+ ZGVkZDE5ZjhiMjIwOWE5YTIxMTY0N2E4NGU0YmM4ZmZjNTZlZWY=
12
+ data.tar.gz: !binary |-
13
+ OWM5YjBhMmIwZDQxZDBjMDM4YjE4OGQ1MmFiNzE5ZjdiZGY3MWUyMmRmNmZj
14
+ YzE1ZGU2ODAwN2JmMjAxMTE2YmM5OTAwOWFjODQ0MjE2N2ZkZjZmNThiN2Fl
15
+ ZDE0MDVkZWZlNTBiMDEzYTVhM2VjMmQ3ZGM2MGNiOGEyODBiNGU=
data/MIT-LICENSE CHANGED
@@ -1,20 +1,20 @@
1
- Copyright (c) 2011 Artem Rufanov
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining
4
- a copy of this software and associated documentation files (the
5
- "Software"), to deal in the Software without restriction, including
6
- without limitation the rights to use, copy, modify, merge, publish,
7
- distribute, sublicense, and/or sell copies of the Software, and to
8
- permit persons to whom the Software is furnished to do so, subject to
9
- the following conditions:
10
-
11
- The above copyright notice and this permission notice shall be
12
- included in all copies or substantial portions of the Software.
13
-
14
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
1
+ Copyright (c) 2011 Artem Rufanov
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README CHANGED
@@ -1,41 +1,41 @@
1
- RailsBreadcrumbs
2
- ===================
3
-
4
- RailsBreadcrumbs is a gem that implements breadcrumbs.
5
-
6
- * The gem supports ruby 1.9.x & rails 3.x
7
- * The gem allows to create breadcrumbs based on path
8
- * The gem allows ...
9
-
10
- Quick Start
11
- =======
12
- In your Gemfile:
13
-
14
- gem "rails_breadcrumbs", ">= 0.5.4"
15
-
16
- In your controller:
17
-
18
- before_filter :add_breadcrumbs_by_path
19
-
20
- In your views:
21
-
22
- <%= render_breadcrumbs %>
23
-
24
- If you wish:
25
-
26
- -Run ruby script/rails generate rails_breadcrumbs to gen resources such as css, sass and png files.
27
- -Use config/initiaizers to configure options for this gem
28
-
29
-
30
- Installation
31
- =======
32
-
33
- * Type 'gem install --local rails_breadcrumbs' with root account if you have installed RubyGems.
34
-
35
-
36
- Example
37
- =======
38
-
39
- Example goes here.
40
-
41
- Copyright (c) 2011 arufanov, released under the MIT license.
1
+ RailsBreadcrumbs
2
+ ===================
3
+
4
+ RailsBreadcrumbs is a gem that implements breadcrumbs.
5
+
6
+ * The gem supports ruby 1.9.x & rails 3.x
7
+ * The gem allows to create breadcrumbs based on path
8
+ * The gem allows ...
9
+
10
+ Quick Start
11
+ =======
12
+ In your Gemfile:
13
+
14
+ gem "rails_breadcrumbs", ">= 0.5.4"
15
+
16
+ In your controller:
17
+
18
+ before_filter :add_breadcrumbs_by_path
19
+
20
+ In your views:
21
+
22
+ <%= render_breadcrumbs %>
23
+
24
+ If you wish:
25
+
26
+ -Run ruby script/rails generate rails_breadcrumbs to gen resources such as css, sass and png files.
27
+ -Use config/initiaizers to configure options for this gem
28
+
29
+
30
+ Installation
31
+ =======
32
+
33
+ * Type 'gem install --local rails_breadcrumbs' with root account if you have installed RubyGems.
34
+
35
+
36
+ Example
37
+ =======
38
+
39
+ Example goes here.
40
+
41
+ Copyright (c) 2011 arufanov, released under the MIT license.
data/Rakefile CHANGED
@@ -1,23 +1,23 @@
1
- require 'rake'
2
- require 'rake/testtask'
3
- require 'rake/rdoctask'
4
-
5
- desc 'Default: run unit tests.'
6
- task :default => :test
7
-
8
- desc 'Test the rails_breadcrumbs plugin.'
9
- Rake::TestTask.new(:test) do |t|
10
- t.libs << 'lib'
11
- t.libs << 'test'
12
- t.pattern = 'test/**/*_test.rb'
13
- t.verbose = true
14
- end
15
-
16
- desc 'Generate documentation for the rails_breadcrumbs plugin.'
17
- Rake::RDocTask.new(:rdoc) do |rdoc|
18
- rdoc.rdoc_dir = 'rdoc'
19
- rdoc.title = 'RailsBreadcrumbs'
20
- rdoc.options << '--line-numbers' << '--inline-source'
21
- rdoc.rdoc_files.include('README')
22
- rdoc.rdoc_files.include('lib/**/*.rb')
23
- end
1
+ require 'rake'
2
+ require 'rake/testtask'
3
+ require 'rake/rdoctask'
4
+
5
+ desc 'Default: run unit tests.'
6
+ task :default => :test
7
+
8
+ desc 'Test the rails_breadcrumbs plugin.'
9
+ Rake::TestTask.new(:test) do |t|
10
+ t.libs << 'lib'
11
+ t.libs << 'test'
12
+ t.pattern = 'test/**/*_test.rb'
13
+ t.verbose = true
14
+ end
15
+
16
+ desc 'Generate documentation for the rails_breadcrumbs plugin.'
17
+ Rake::RDocTask.new(:rdoc) do |rdoc|
18
+ rdoc.rdoc_dir = 'rdoc'
19
+ rdoc.title = 'RailsBreadcrumbs'
20
+ rdoc.options << '--line-numbers' << '--inline-source'
21
+ rdoc.rdoc_files.include('README')
22
+ rdoc.rdoc_files.include('lib/**/*.rb')
23
+ end
data/changelog CHANGED
@@ -1,24 +1,24 @@
1
- Introduction:
2
- To see the latest list of the change log please visit the Change Log page at www.majoron.com.
3
-
4
- Legend:
5
- Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
- then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
- Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
- And then follow a short description of the bug.
9
-
10
- Example:
11
- For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
- that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
- 380 number at bug tracking system. And bug requires STLPort support implementation.
14
-
15
- Version 0.5
16
- -----------
17
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Localize home_label
18
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Don't put separator for root
19
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Move separator out of link
20
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Changed item separator from '&gt;' to ' &gt;'
21
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Added configuratin parameter to show Home string instead of Home icons
22
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Changelog, roadmap, knownbugs have been created
23
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Use include, extend instead of class_eval
24
- 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / home_controller, home_action has been changed to home_path
1
+ Introduction:
2
+ To see the latest list of the change log please visit the Change Log page at www.majoron.com.
3
+
4
+ Legend:
5
+ Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
+ then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
+ Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
+ And then follow a short description of the bug.
9
+
10
+ Example:
11
+ For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
+ that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
+ 380 number at bug tracking system. And bug requires STLPort support implementation.
14
+
15
+ Version 0.5
16
+ -----------
17
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Localize home_label
18
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Don't put separator for root
19
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Move separator out of link
20
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Changed item separator from '&gt;' to ' &gt;'
21
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Added configuratin parameter to show Home string instead of Home icons
22
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Changelog, roadmap, knownbugs have been created
23
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / Use include, extend instead of class_eval
24
+ 0.5 { Bug Report } [ RailsBreadcrumbs ] / X / home_controller, home_action has been changed to home_path
data/init.rb CHANGED
@@ -1,2 +1,2 @@
1
- # Include hook code here
2
- require 'rails_breadcrumbs'
1
+ # Include hook code here
2
+ require 'rails_breadcrumbs'
data/install.rb CHANGED
@@ -1 +1 @@
1
- # Install hook code here
1
+ # Install hook code here
data/knownbugs CHANGED
@@ -1,17 +1,17 @@
1
- Introduction:
2
- To see the latest list of the known bugs please visit the Known bugs page at www.majoron.com.
3
-
4
- Legend:
5
- Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
- then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
- Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
- And then follow a short description of the bug.
9
-
10
- Example:
11
- For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
- that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
- 380 number at bug tracking system. And bug requires STLPort support implementation.
14
-
15
- Version 0.5
16
- -----------
17
- 0.5 { Bug Report } [ AuxiliaryAddons ] / X / There isn't known bugs
1
+ Introduction:
2
+ To see the latest list of the known bugs please visit the Known bugs page at www.majoron.com.
3
+
4
+ Legend:
5
+ Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
+ then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
+ Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
+ And then follow a short description of the bug.
9
+
10
+ Example:
11
+ For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
+ that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
+ 380 number at bug tracking system. And bug requires STLPort support implementation.
14
+
15
+ Version 0.5
16
+ -----------
17
+ 0.5 { Bug Report } [ AuxiliaryAddons ] / X / There isn't known bugs
@@ -1,3 +1,3 @@
1
- Description:
2
- The rails_breadcrumbs generator creates an home icons at public/breadcrumbs
3
- and rails_breadcrumbs css & cass at public/stylesheets/ directory.
1
+ Description:
2
+ The rails_breadcrumbs generator creates an home icons at public/breadcrumbs
3
+ and rails_breadcrumbs css & cass at public/stylesheets/ directory.
@@ -1,13 +1,13 @@
1
- module RailsBreadcrumbs
2
- module Generators
3
- class RailsBreadcrumbsGenerator < Rails::Generators::Base
4
- source_root File.expand_path('../templates', __FILE__)
5
-
6
- def generate_rails_breadcrumbs
7
- copy_file "home.png", "public/images/breadcrumbs/home.png"
8
- copy_file "rails_breadcrumbs.css", "public/stylesheets/rails_breadcrumbs.css"
9
- copy_file "rails_breadcrumbs.sass", "public/stylesheets/rails_breadcrumbs.sass"
10
- end
11
- end
12
- end
13
- end
1
+ module RailsBreadcrumbs
2
+ module Generators
3
+ class RailsBreadcrumbsGenerator < Rails::Generators::Base
4
+ source_root File.expand_path('../templates', __FILE__)
5
+
6
+ def generate_rails_breadcrumbs
7
+ copy_file "home.png", "public/images/breadcrumbs/home.png"
8
+ copy_file "rails_breadcrumbs.css", "public/stylesheets/rails_breadcrumbs.css"
9
+ copy_file "rails_breadcrumbs.sass", "public/stylesheets/rails_breadcrumbs.sass"
10
+ end
11
+ end
12
+ end
13
+ end
@@ -1,22 +1,22 @@
1
- /* =Breadcrumbs styles
2
- * This section contains breadcrumb's styles for markup
3
- * <div id="breadcrumbs">
4
- * <span>You are here:</span> <%= render_breadcrumbs %>
5
- * </div>
6
- */
7
- #breadcrumbs {
8
- float: left; }
9
- #breadcrumbs span {
10
- float: left;
11
- font-size: 120%; }
12
- #breadcrumbs ul.breadcrumbs {
13
- float: left; }
14
- #breadcrumbs ul.breadcrumbs li {
15
- border: 1px;
16
- float: left; }
17
- #breadcrumbs ul.breadcrumbs li.first_breadcrumb_item {
18
- border: 1px; }
19
- #breadcrumbs ul.breadcrumbs li.last_breadcrumb_item a {
20
- font-weight: bold; }
21
- #breadcrumbs ul.breadcrumbs li.last_breadcrumb_item span {
22
- font-weight: bold; }
1
+ /* =Breadcrumbs styles
2
+ * This section contains breadcrumb's styles for markup
3
+ * <div id="breadcrumbs">
4
+ * <span>You are here:</span> <%= render_breadcrumbs %>
5
+ * </div>
6
+ */
7
+ #breadcrumbs {
8
+ float: left; }
9
+ #breadcrumbs span {
10
+ float: left;
11
+ font-size: 120%; }
12
+ #breadcrumbs ul.breadcrumbs {
13
+ float: left; }
14
+ #breadcrumbs ul.breadcrumbs li {
15
+ border: 1px;
16
+ float: left; }
17
+ #breadcrumbs ul.breadcrumbs li.first_breadcrumb_item {
18
+ border: 1px; }
19
+ #breadcrumbs ul.breadcrumbs li.last_breadcrumb_item a {
20
+ font-weight: bold; }
21
+ #breadcrumbs ul.breadcrumbs li.last_breadcrumb_item span {
22
+ font-weight: bold; }
@@ -1,23 +1,23 @@
1
- /* =Breadcrumbs styles
2
- * This section contains breadcrumb's styles for markup
3
- * <div id="breadcrumbs">
4
- * <span>You are here:</span> <%= render_breadcrumbs %>
5
- * </div>
6
- */
7
- #breadcrumbs
8
- float: left
9
- span
10
- float: left
11
- font-size: 120%
12
- ul.breadcrumbs
13
- float: left
14
- li
15
- border: 1px
16
- float: left
17
- li.first_breadcrumb_item
18
- border: 1px
19
- li.last_breadcrumb_item
20
- a
21
- font-weight: bold
22
- span
1
+ /* =Breadcrumbs styles
2
+ * This section contains breadcrumb's styles for markup
3
+ * <div id="breadcrumbs">
4
+ * <span>You are here:</span> <%= render_breadcrumbs %>
5
+ * </div>
6
+ */
7
+ #breadcrumbs
8
+ float: left
9
+ span
10
+ float: left
11
+ font-size: 120%
12
+ ul.breadcrumbs
13
+ float: left
14
+ li
15
+ border: 1px
16
+ float: left
17
+ li.first_breadcrumb_item
18
+ border: 1px
19
+ li.last_breadcrumb_item
20
+ a
21
+ font-weight: bold
22
+ span
23
23
  font-weight: bold
@@ -1,64 +1,67 @@
1
- #
2
- module RailsBreadcrumbs
3
- module ControllerAdditions
4
- # ::Rails.logger.error("...")
5
-
6
- #
7
- def self.add_breadcrumb(name, url, options = {})
8
- before_filter options do |controller|
9
- controller.send(:add_breadcrumb, name, url)
10
- end
11
- end
12
-
13
- # Add breadcrumb for page
14
- def add_breadcrumb name, url = ''
15
- @breadcrumbs ||= []
16
- url = eval(url) if url =~ /_path|_url|@/
17
- @breadcrumbs << [name, url]
18
- end
19
-
20
- #
21
- def add_breadcrumbs_by_path(names = {}, options = {})
22
- options = ::RailsBreadcrumbs.options.merge(options)
23
- path_parts = controller_path.split('/')
24
- path_parts.each do |segment|
25
- link_name = segment.sub('_', ' ').camelcase
26
- link_name = names[segment] if names.has_key?(segment)
27
- name = I18n.t options[:locale_root] + segment, :default => link_name
28
- if segment != path_parts.last
29
- route = nil
30
- path_parts.each do |temp|
31
- route = (route.nil? ? temp: route +'_'+ temp)
32
- break if temp == segment
33
- end
34
- link = send(route + '_path')
35
- else
36
- link = request.path
37
- end
38
- add_breadcrumb(name, link)
39
- end
40
- end
41
-
42
- #
43
- def add_breadcrumbs_with_action_by_path(names = {}, options = {})
44
- options = ::RailsBreadcrumbs.options.merge(options)
45
- path_parts = controller_path.split('/') << action_name
46
- path_parts.each do |segment|
47
- link_name = segment.sub('_', ' ').camelcase
48
- link_name = names[segment] if names.has_key?(segment)
49
- name = I18n.t options[:locale_root] + segment, :default => link_name
50
- if segment != path_parts.last
51
- route = nil
52
- path_parts.each do |temp|
53
- route = (route.nil? ? temp: route +'_'+ temp)
54
- break if temp == segment
55
- end
56
- link = send(route + '_path')
57
- else
58
- link = request.path
59
- end
60
- add_breadcrumb(name, link)
61
- end
62
- end
63
- end
64
- end
1
+ module RailsBreadcrumbs
2
+ module ControllerAdditions
3
+ extend ActiveSupport::Concern
4
+
5
+ included do
6
+ extend ClassMethods
7
+ end
8
+
9
+ module ClassMethods
10
+ def add_breadcrumb(name, url, options = {})
11
+ before_filter options do |controller|
12
+ controller.send(:add_breadcrumb, name, url)
13
+ end
14
+ end
15
+ end
16
+
17
+ def add_breadcrumbs_by_path(names = {}, options = {})
18
+ options = ::RailsBreadcrumbs.options.merge(options)
19
+ path_parts = controller_path.split('/')
20
+ path_parts.each do |segment|
21
+ link_name = segment.sub('_', ' ').camelcase
22
+ link_name = names[segment] if names.has_key?(segment)
23
+ name = I18n.t options[:locale_root] + segment, :default => link_name
24
+ if segment != path_parts.last
25
+ route = nil
26
+ path_parts.each do |temp|
27
+ route = (route.nil? ? temp: route +'_'+ temp)
28
+ break if temp == segment
29
+ end
30
+ link = send(route + '_path')
31
+ else
32
+ link = request.path
33
+ end
34
+ add_breadcrumb(name, link)
35
+ end
36
+ end
37
+
38
+ def add_breadcrumbs_with_action_by_path(names = {}, options = {})
39
+ options = ::RailsBreadcrumbs.options.merge(options)
40
+ path_parts = controller_path.split('/') << action_name
41
+ path_parts.each do |segment|
42
+ link_name = segment.sub('_', ' ').camelcase
43
+ link_name = names[segment] if names.has_key?(segment)
44
+ name = I18n.t options[:locale_root] + segment, :default => link_name
45
+ if segment != path_parts.last
46
+ route = nil
47
+ path_parts.each do |temp|
48
+ route = (route.nil? ? temp: route +'_'+ temp)
49
+ break if temp == segment
50
+ end
51
+ link = send(route + '_path')
52
+ else
53
+ link = request.path
54
+ end
55
+ add_breadcrumb(name, link)
56
+ end
57
+ end
58
+
59
+ private
60
+ # Add breadcrumb for page
61
+ def add_breadcrumb name, url = ''
62
+ @breadcrumbs ||= []
63
+ url = eval(url.to_s) if url =~ /_path|_url|@/
64
+ @breadcrumbs << [name, url]
65
+ end
66
+ end
67
+ end
@@ -1,6 +1,6 @@
1
- #
2
- module RailsBreadcrumbs
3
- module ModelAdditions
4
- # ::Rails.logger.error("...")
5
- end
1
+ #
2
+ module RailsBreadcrumbs
3
+ module ModelAdditions
4
+ # ::Rails.logger.error("...")
5
+ end
6
6
  end
@@ -1,73 +1,73 @@
1
- #
2
- module RailsBreadcrumbs
3
- module ViewAdditions
4
- # ::Rails.logger.error("...")
5
-
6
- #
7
- # Renders breadcrumbs
8
- #
9
- # <ul>
10
- # <li class="first">
11
- # <%=link_to(image_tag("breadcrumbs/home.png", {:alt => "Home", :title => "Home"}), :controller => "/welcome") %> &gt;
12
- # </li>
13
- # <% if @breadcrumbs %>
14
- # <% @breadcrumbs[0..-2].each do |txt, path| %>
15
- # <li>
16
- # <%= link_to(h(txt), path) %> &gt;
17
- # </li>
18
- # <% end %>
19
- # <li>
20
- # <span><%= link_to(h(@breadcrumbs.last.first), @breadcrumbs.last.second) %> </span>
21
- # </li>
22
- # <% end %>
23
- # </ul>
24
- #
25
- def render_breadcrumbs(options = {})
26
- output = ""
27
- options = ::RailsBreadcrumbs.options.merge(options)
28
- home = I18n.t(options[:locale_root] + options[:home_label], :default => options[:home_label])
29
-
30
- # First item is home
31
- if options[:include_home_icon]
32
- output << content_tag(:li, {:class => "first_breadcrumb_item"}, false) do
33
- link_to(image_tag("breadcrumbs/home.png", {:alt => home, :title => home}),options[:home_path]) +
34
- (@breadcrumbs && @breadcrumbs.size() > 0 ? raw(options[:item_separator]) : "")
35
- end
36
- end
37
-
38
- # First item is home
39
- if options[:include_home_label]
40
- output << content_tag(:li, {:class => "first_breadcrumb_item"}, false) do
41
- link_to( h(home), options[:home_path]) +
42
- (@breadcrumbs && @breadcrumbs.size() > 0 ? raw(options[:item_separator]) : "")
43
- end
44
- end
45
-
46
- # Midle items
47
- if @breadcrumbs
48
- @breadcrumbs[0..-2].each do |txt, path|
49
- output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
50
- link_to( h(txt), path) + raw(options[:item_separator])
51
- end
52
- end
53
- end
54
-
55
- # Last item
56
- if @breadcrumbs
57
- if options[:make_last_item_as_link]
58
- output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
59
- link_to( h(@breadcrumbs.last.first), @breadcrumbs.last.second)
60
- end
61
- else
62
- output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
63
- content_tag(:span, h(@breadcrumbs.last.first))
64
- end
65
- end
66
- end
67
-
68
- # Return result
69
- content_tag('ul', output, {:class => options[:css_class]}, false)
70
- end
71
-
72
- end
1
+ #
2
+ module RailsBreadcrumbs
3
+ module ViewAdditions
4
+ # ::Rails.logger.error("...")
5
+
6
+ #
7
+ # Renders breadcrumbs
8
+ #
9
+ # <ul>
10
+ # <li class="first">
11
+ # <%=link_to(image_tag("breadcrumbs/home.png", {:alt => "Home", :title => "Home"}), :controller => "/welcome") %> &gt;
12
+ # </li>
13
+ # <% if @breadcrumbs %>
14
+ # <% @breadcrumbs[0..-2].each do |txt, path| %>
15
+ # <li>
16
+ # <%= link_to(h(txt), path) %> &gt;
17
+ # </li>
18
+ # <% end %>
19
+ # <li>
20
+ # <span><%= link_to(h(@breadcrumbs.last.first), @breadcrumbs.last.second) %> </span>
21
+ # </li>
22
+ # <% end %>
23
+ # </ul>
24
+ #
25
+ def render_breadcrumbs(options = {})
26
+ output = ""
27
+ options = ::RailsBreadcrumbs.options.merge(options)
28
+ home = I18n.t(options[:locale_root] + options[:home_label], :default => options[:home_label])
29
+
30
+ # First item is home
31
+ if options[:include_home_icon]
32
+ output << content_tag(:li, {:class => "first_breadcrumb_item"}, false) do
33
+ link_to(image_tag("breadcrumbs/home.png", {:alt => home, :title => home}),options[:home_path]) +
34
+ (@breadcrumbs && @breadcrumbs.size() > 0 ? raw(options[:item_separator]) : "")
35
+ end
36
+ end
37
+
38
+ # First item is home
39
+ if options[:include_home_label]
40
+ output << content_tag(:li, {:class => "first_breadcrumb_item"}, false) do
41
+ link_to( h(home), options[:home_path]) +
42
+ (@breadcrumbs && @breadcrumbs.size() > 0 ? raw(options[:item_separator]) : "")
43
+ end
44
+ end
45
+
46
+ # Midle items
47
+ if @breadcrumbs
48
+ @breadcrumbs[0..-2].each do |txt, path|
49
+ output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
50
+ link_to( h(txt), path) + raw(options[:item_separator])
51
+ end
52
+ end
53
+ end
54
+
55
+ # Last item
56
+ if @breadcrumbs
57
+ if options[:make_last_item_as_link]
58
+ output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
59
+ link_to( h(@breadcrumbs.last.first), @breadcrumbs.last.second)
60
+ end
61
+ else
62
+ output << content_tag(:li, {:class => "last_breadcrumb_item"}, false) do
63
+ content_tag(:span, h(@breadcrumbs.last.first))
64
+ end
65
+ end
66
+ end
67
+
68
+ # Return result
69
+ content_tag('ul', output, {:class => options[:css_class]}, false)
70
+ end
71
+
72
+ end
73
73
  end
@@ -1,43 +1,43 @@
1
- # Include
2
- require 'rubygems'
3
- require 'active_support'
4
- require 'rails_breadcrumbs/model_additions'
5
- require 'rails_breadcrumbs/controller_additions'
6
- require 'rails_breadcrumbs/view_additions'
7
-
8
- # = Rails breadcrumbs
9
- #
10
- module RailsBreadcrumbs
11
- # ::Rails.logger.error("...")
12
-
13
- # default options that can be overridden on the global level
14
- @@options = {
15
- :locale_root => 'navigation.breadcrumbs.', #
16
- :home_path => '/welcome', #
17
- :home_label => 'Home', #
18
- :item_separator => ' &gt;', #
19
- :css_class => 'breadcrumbs', #
20
- :fist_item_css_class => 'first_breadcrumb_item', #
21
- :last_item_css_class => 'last_breadcrumb_item', #
22
- :make_last_item_as_link => true, #
23
- :include_home_icon => true, #
24
- :include_home_label => false, #
25
- }
26
- mattr_reader :options
27
-
28
-
29
- def self.enable_activerecord
30
- ActiveRecord::Base.send :include, RailsBreadcrumbs::ModelAdditions
31
- end
32
-
33
- def self.enable_actionpack
34
- ActionController::Base.send :include, RailsBreadcrumbs::ControllerAdditions
35
-
36
- ActionView::Base.send :include, RailsBreadcrumbs::ViewAdditions
37
- end
38
- end
39
-
40
- if defined? Rails
41
- RailsBreadcrumbs.enable_activerecord if defined? ActiveRecord
42
- RailsBreadcrumbs.enable_actionpack if defined? ActionController
43
- end
1
+ # Include
2
+ require 'rubygems'
3
+ require 'active_support'
4
+ require 'rails_breadcrumbs/model_additions'
5
+ require 'rails_breadcrumbs/controller_additions'
6
+ require 'rails_breadcrumbs/view_additions'
7
+
8
+ # = Rails breadcrumbs
9
+ #
10
+ module RailsBreadcrumbs
11
+ # ::Rails.logger.error("...")
12
+
13
+ # default options that can be overridden on the global level
14
+ @@options = {
15
+ :locale_root => 'navigation.breadcrumbs.', #
16
+ :home_path => '/welcome', #
17
+ :home_label => 'Home', #
18
+ :item_separator => ' &gt;', #
19
+ :css_class => 'breadcrumbs', #
20
+ :fist_item_css_class => 'first_breadcrumb_item', #
21
+ :last_item_css_class => 'last_breadcrumb_item', #
22
+ :make_last_item_as_link => true, #
23
+ :include_home_icon => true, #
24
+ :include_home_label => false, #
25
+ }
26
+ mattr_reader :options
27
+
28
+
29
+ def self.enable_activerecord
30
+ ActiveRecord::Base.send :include, RailsBreadcrumbs::ModelAdditions
31
+ end
32
+
33
+ def self.enable_actionpack
34
+ ActionController::Base.send :include, RailsBreadcrumbs::ControllerAdditions
35
+
36
+ ActionView::Base.send :include, RailsBreadcrumbs::ViewAdditions
37
+ end
38
+ end
39
+
40
+ if defined? Rails
41
+ RailsBreadcrumbs.enable_activerecord if defined? ActiveRecord
42
+ RailsBreadcrumbs.enable_actionpack if defined? ActionController
43
+ end
@@ -1,17 +1,17 @@
1
- require 'date'
2
- Gem::Specification.new do |s|
3
- s.name = %q{rails_breadcrumbs}
4
- s.version = "0.5.4"
5
- s.date = Date.today.to_s
6
- s.summary = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
7
- s.description = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
8
- s.author = %q{Artem Rufanov}
9
- s.email = %q{developers@majoron.com}
10
- s.homepage = %q{http://www.majoron.com/project/rbundle/rails_breadcrumbs}
11
- s.files = Dir.glob('**/*') - Dir.glob('distrib/**/*') - Dir.glob('lib/api/**/*') - Dir.glob('doc/*.xpr')
12
- s.bindir = 'bin'
13
- s.executables = Dir.glob('bin/*').collect {|f| File.basename(f)}
14
- s.require_paths << 'doc' << 'examples' << 'lib' << 'test'
15
- s.has_rdoc = true
16
- s.required_ruby_version = '>= 1.8.7'
17
- end
1
+ require 'date'
2
+ Gem::Specification.new do |s|
3
+ s.name = %q{rails_breadcrumbs}
4
+ s.version = "0.5.5"
5
+ s.date = Date.today.to_s
6
+ s.summary = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
7
+ s.description = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
8
+ s.author = %q{Artem Rufanov}
9
+ s.email = %q{developers@majoron.com}
10
+ s.homepage = %q{http://www.majoron.com/project/rbundle/rails_breadcrumbs}
11
+ s.files = Dir.glob('**/*') - Dir.glob('distrib/**/*') - Dir.glob('lib/api/**/*') - Dir.glob('doc/*.xpr')
12
+ s.bindir = 'bin'
13
+ s.executables = Dir.glob('bin/*').collect {|f| File.basename(f)}
14
+ s.require_paths << 'doc' << 'examples' << 'lib' << 'test'
15
+ s.has_rdoc = true
16
+ s.required_ruby_version = '>= 1.8.7'
17
+ end
data/roadmap CHANGED
@@ -1,19 +1,19 @@
1
- Introduction:
2
- To see the latest list of the roadmap please visit the Roadmap page at www.majoron.com.
3
-
4
- Legend:
5
- Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
- then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
- Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
- And then follow a short description of the bug.
9
-
10
- Example:
11
- For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
- that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
- 380 number at bug tracking system. And bug requires STLPort support implementation.
14
-
15
- Version 0.5
16
- -----------
17
- 0.5 { Feature Request } [ RailsBreadcrumbs ] / X / Add tests
18
- 0.5 { Feature Request } [ RailsBreadcrumbs ] / X / Add RailsTie
19
-
1
+ Introduction:
2
+ To see the latest list of the roadmap please visit the Roadmap page at www.majoron.com.
3
+
4
+ Legend:
5
+ Follow notation is used at change log, roadmap and known bugs. Each bug begins with a version,
6
+ then follow category of the bug inside {}. It can be bug report, feature request and etc.
7
+ Then follow component inside []. After follow bug number at bug tracking system between // signs.
8
+ And then follow a short description of the bug.
9
+
10
+ Example:
11
+ For example bug: "1.0 { Feature Request } [ AntHill ] / 380 / STLport support required" means
12
+ that bug was created for 1.0 version of the AntHill component, bug is feature request with
13
+ 380 number at bug tracking system. And bug requires STLPort support implementation.
14
+
15
+ Version 0.5
16
+ -----------
17
+ 0.5 { Feature Request } [ RailsBreadcrumbs ] / X / Add tests
18
+ 0.5 { Feature Request } [ RailsBreadcrumbs ] / X / Add RailsTie
19
+
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
2
-
3
- describe RailsBreadcrumbs::ControllerAdditions do
4
- it "should define controller additions" do
5
- ::RailsBreadcrumbs::ControllerAdditions.should be
6
- end
7
- end
1
+ require 'spec_helper'
2
+
3
+ describe RailsBreadcrumbs::ControllerAdditions do
4
+ it "should define controller additions" do
5
+ ::RailsBreadcrumbs::ControllerAdditions.should be
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
2
-
3
- describe RailsBreadcrumbs::ModelAdditions do
4
- it "should define model additions" do
5
- ::RailsBreadcrumbs::ModelAdditions.should be
6
- end
7
- end
1
+ require 'spec_helper'
2
+
3
+ describe RailsBreadcrumbs::ModelAdditions do
4
+ it "should define model additions" do
5
+ ::RailsBreadcrumbs::ModelAdditions.should be
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
2
-
3
- describe RailsBreadcrumbs::ViewAdditions do
4
- it "should define view additions" do
5
- ::RailsBreadcrumbs::ViewAdditions.should be
6
- end
7
- end
1
+ require 'spec_helper'
2
+
3
+ describe RailsBreadcrumbs::ViewAdditions do
4
+ it "should define view additions" do
5
+ ::RailsBreadcrumbs::ViewAdditions.should be
6
+ end
7
+ end
@@ -1,7 +1,7 @@
1
- require 'spec_helper'
2
-
3
- describe RailsBreadcrumbs do
4
- it "should define rails" do
5
- ::Rails::VERSION::MAJOR.should be
6
- end
7
- end
1
+ require 'spec_helper'
2
+
3
+ describe RailsBreadcrumbs do
4
+ it "should define rails" do
5
+ ::Rails::VERSION::MAJOR.should be
6
+ end
7
+ end
data/spec/spec.opts CHANGED
@@ -1,2 +1,2 @@
1
- --color
2
- --backtrace
1
+ --color
2
+ --backtrace
data/spec/spec_helper.rb CHANGED
@@ -1,23 +1,23 @@
1
- $:.unshift File.dirname(__FILE__)
2
- $:.unshift File.join(File.dirname(__FILE__), '../lib')
3
-
4
- ENV["RAILS_ENV"] = "test"
5
- require 'rubygems'
6
- require 'rspec'
7
- require 'action_controller'
8
- require 'rails_breadcrumbs'
9
-
10
- module Rails
11
- module VERSION
12
- MAJOR = 3
13
- end
14
- end unless defined? Rails
15
-
16
- # RailsBreadcrumbs.root = './'
17
- RAILS_ROOT = './' unless defined?(RAILS_ROOT)
18
- RAILS_ENV = 'test' unless defined?(RAILS_ENV)
19
-
20
- RSpec.configure do |config|
21
- config.mock_with :rspec
22
- end
23
-
1
+ $:.unshift File.dirname(__FILE__)
2
+ $:.unshift File.join(File.dirname(__FILE__), '../lib')
3
+
4
+ ENV["RAILS_ENV"] = "test"
5
+ require 'rubygems'
6
+ require 'rspec'
7
+ require 'action_controller'
8
+ require 'rails_breadcrumbs'
9
+
10
+ module Rails
11
+ module VERSION
12
+ MAJOR = 3
13
+ end
14
+ end unless defined? Rails
15
+
16
+ # RailsBreadcrumbs.root = './'
17
+ RAILS_ROOT = './' unless defined?(RAILS_ROOT)
18
+ RAILS_ENV = 'test' unless defined?(RAILS_ENV)
19
+
20
+ RSpec.configure do |config|
21
+ config.mock_with :rspec
22
+ end
23
+
@@ -1,4 +1,4 @@
1
- # desc "Explaining what the task does"
2
- # task :captcha_validateable do
3
- # # Task goes here
4
- # end
1
+ # desc "Explaining what the task does"
2
+ # task :captcha_validateable do
3
+ # # Task goes here
4
+ # end
data/uninstall.rb CHANGED
@@ -1 +1 @@
1
- # Uninstall hook code here
1
+ # Uninstall hook code here
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_breadcrumbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
5
- prerelease:
4
+ version: 0.5.5
6
5
  platform: ruby
7
6
  authors:
8
7
  - Artem Rufanov
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2012-08-11 00:00:00.000000000 Z
11
+ date: 2014-07-07 00:00:00.000000000 Z
13
12
  dependencies: []
14
13
  description: RailsBreadcrumbs is a gem that implements breadcrumbs.
15
14
  email: developers@majoron.com
@@ -17,24 +16,23 @@ executables: []
17
16
  extensions: []
18
17
  extra_rdoc_files: []
19
18
  files:
19
+ - MIT-LICENSE
20
+ - README
21
+ - Rakefile
20
22
  - changelog
21
23
  - init.rb
22
24
  - install.rb
23
25
  - knownbugs
26
+ - lib/generators/rails_breadcrumbs/USAGE
24
27
  - lib/generators/rails_breadcrumbs/rails_breadcrumbs_generator.rb
25
28
  - lib/generators/rails_breadcrumbs/templates/home.png
26
29
  - lib/generators/rails_breadcrumbs/templates/rails_breadcrumbs.css
27
30
  - lib/generators/rails_breadcrumbs/templates/rails_breadcrumbs.sass
28
- - lib/generators/rails_breadcrumbs/USAGE
31
+ - lib/rails_breadcrumbs.rb
29
32
  - lib/rails_breadcrumbs/controller_additions.rb
30
33
  - lib/rails_breadcrumbs/model_additions.rb
31
34
  - lib/rails_breadcrumbs/view_additions.rb
32
- - lib/rails_breadcrumbs.rb
33
- - MIT-LICENSE
34
- - rails_breadcrumbs-0.5.4.gem
35
35
  - rails_breadcrumbs.gemspec
36
- - Rakefile
37
- - README
38
36
  - roadmap
39
37
  - spec/lib/rails_breadcrumbs/controller_additions_spec.rb
40
38
  - spec/lib/rails_breadcrumbs/model_additions_spec.rb
@@ -46,6 +44,7 @@ files:
46
44
  - uninstall.rb
47
45
  homepage: http://www.majoron.com/project/rbundle/rails_breadcrumbs
48
46
  licenses: []
47
+ metadata: {}
49
48
  post_install_message:
50
49
  rdoc_options: []
51
50
  require_paths:
@@ -55,21 +54,19 @@ require_paths:
55
54
  - lib
56
55
  - test
57
56
  required_ruby_version: !ruby/object:Gem::Requirement
58
- none: false
59
57
  requirements:
60
58
  - - ! '>='
61
59
  - !ruby/object:Gem::Version
62
60
  version: 1.8.7
63
61
  required_rubygems_version: !ruby/object:Gem::Requirement
64
- none: false
65
62
  requirements:
66
63
  - - ! '>='
67
64
  - !ruby/object:Gem::Version
68
65
  version: '0'
69
66
  requirements: []
70
67
  rubyforge_project:
71
- rubygems_version: 1.8.23
68
+ rubygems_version: 2.2.2
72
69
  signing_key:
73
- specification_version: 3
70
+ specification_version: 4
74
71
  summary: RailsBreadcrumbs is a gem that implements breadcrumbs.
75
72
  test_files: []