rails_breadcrumbs 0.5.5 → 0.5.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NDM5OWM0YTMxZTc3YWY5ODE1NDlmYmZiYTQ5NWRjMjhlODFiMTY1MQ==
5
- data.tar.gz: !binary |-
6
- NzZmMWQwOTJiNzVkZTNmOThiM2Q3Yjg0NGRjYzY3NDU1OTVkZDVkOA==
2
+ SHA1:
3
+ metadata.gz: e33134645ba659ad3fa78672041bd32478eda5a0
4
+ data.tar.gz: 37bb58ae07982d773f469918cc151c0cf35f796b
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZDc4ZGFjYzU0YmY1ZDBiNWEzYWU5NzkyYmEzMGE0NzVmNTJjMDc0YzE4ZjRi
10
- MjE3MzY0NDczNDkzMmU5YjllZDY2NjNmMmQ1YTJiOGUxNWZlZGJlMWQzOGJj
11
- ZGVkZDE5ZjhiMjIwOWE5YTIxMTY0N2E4NGU0YmM4ZmZjNTZlZWY=
12
- data.tar.gz: !binary |-
13
- OWM5YjBhMmIwZDQxZDBjMDM4YjE4OGQ1MmFiNzE5ZjdiZGY3MWUyMmRmNmZj
14
- YzE1ZGU2ODAwN2JmMjAxMTE2YmM5OTAwOWFjODQ0MjE2N2ZkZjZmNThiN2Fl
15
- ZDE0MDVkZWZlNTBiMDEzYTVhM2VjMmQ3ZGM2MGNiOGEyODBiNGU=
6
+ metadata.gz: 055fc1f671dffa18ccbee3acb97057cbb6e906b961737775c4481b2b7d8d9a2d9a821bfef59144c6733e7811f9d6c2e44563072a74adf6a28418327301b0b73e
7
+ data.tar.gz: 520a99bb53afab84f47e0d0eeea401050d39f21a306bd67d44ac8bda19cbc97887b643e1dc993a3ed6d7c6b9ef591a7390a8407852d12c749e100b98705a360e
@@ -14,6 +14,21 @@ module RailsBreadcrumbs
14
14
  end
15
15
  end
16
16
 
17
+ def add_breadcrumb_with_parent(object, path, options={})
18
+ return unless object.present?
19
+ if defined?(Ancestry) && Ancestry::InstanceMethods.instance_methods.include?(:path)
20
+ object.path.each do |element|
21
+ make_url_and_add_breadcrumb(element, path, options)
22
+ end
23
+ elsif object.parent.present?
24
+ [object.parent, object].each do |element|
25
+ make_url_and_add_breadcrumb(element, path, options)
26
+ end
27
+ else
28
+ make_url_and_add_breadcrumb(object, path, options)
29
+ end
30
+ end
31
+
17
32
  def add_breadcrumbs_by_path(names = {}, options = {})
18
33
  options = ::RailsBreadcrumbs.options.merge(options)
19
34
  path_parts = controller_path.split('/')
@@ -63,5 +78,11 @@ module RailsBreadcrumbs
63
78
  url = eval(url.to_s) if url =~ /_path|_url|@/
64
79
  @breadcrumbs << [name, url]
65
80
  end
81
+
82
+ def make_url_and_add_breadcrumb(object, path, options)
83
+ url_option = options[:url_option].present? ? options[:url_option] : object.class.name.underscore
84
+ url = path.to_s + "(#{url_option}: '#{object.slug}')"
85
+ send(:add_breadcrumb, object.name, url)
86
+ end
66
87
  end
67
88
  end
@@ -1,7 +1,7 @@
1
1
  require 'date'
2
2
  Gem::Specification.new do |s|
3
3
  s.name = %q{rails_breadcrumbs}
4
- s.version = "0.5.5"
4
+ s.version = "0.5.6"
5
5
  s.date = Date.today.to_s
6
6
  s.summary = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
7
7
  s.description = %q{RailsBreadcrumbs is a gem that implements breadcrumbs.}
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_breadcrumbs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.5
4
+ version: 0.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Artem Rufanov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-07-07 00:00:00.000000000 Z
11
+ date: 2014-07-12 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RailsBreadcrumbs is a gem that implements breadcrumbs.
14
14
  email: developers@majoron.com
@@ -55,12 +55,12 @@ require_paths:
55
55
  - test
56
56
  required_ruby_version: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - ! '>='
58
+ - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.8.7
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ! '>='
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
65
  version: '0'
66
66
  requirements: []