rails_breadcrumbs 0.5.6 → 0.5.7

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,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e33134645ba659ad3fa78672041bd32478eda5a0
4
- data.tar.gz: 37bb58ae07982d773f469918cc151c0cf35f796b
3
+ metadata.gz: 499ada8e53797f18823433809cc0a40f6bf4b8d8
4
+ data.tar.gz: ab246d30f73fd05dc26c066f3d941ad82f41bab5
5
5
  SHA512:
6
- metadata.gz: 055fc1f671dffa18ccbee3acb97057cbb6e906b961737775c4481b2b7d8d9a2d9a821bfef59144c6733e7811f9d6c2e44563072a74adf6a28418327301b0b73e
7
- data.tar.gz: 520a99bb53afab84f47e0d0eeea401050d39f21a306bd67d44ac8bda19cbc97887b643e1dc993a3ed6d7c6b9ef591a7390a8407852d12c749e100b98705a360e
6
+ metadata.gz: 9263cd710811d05e0c5e833bc79d4b91ff834e9d419c05700d5b8f5113ab9f92c1ab3246afe51202d098242e06a713d264e7f1739f4b95a66858ba621bd5ec2e
7
+ data.tar.gz: cc68593c170f00109693510637768bb34e1c7d545141791147cfad95d2c35f7c0f2cf54790896caf8ac82f83cd34ac56b55ccac6736cf15c52d1b72fba78c876
@@ -21,7 +21,8 @@ module RailsBreadcrumbs
21
21
  :last_item_css_class => 'last_breadcrumb_item', #
22
22
  :make_last_item_as_link => true, #
23
23
  :include_home_icon => true, #
24
- :include_home_label => false, #
24
+ :include_home_label => false, #
25
+ :url_options => {} #
25
26
  }
26
27
  mattr_reader :options
27
28
 
@@ -16,6 +16,7 @@ module RailsBreadcrumbs
16
16
 
17
17
  def add_breadcrumb_with_parent(object, path, options={})
18
18
  return unless object.present?
19
+ options = ::RailsBreadcrumbs.options.merge(options)
19
20
  if defined?(Ancestry) && Ancestry::InstanceMethods.instance_methods.include?(:path)
20
21
  object.path.each do |element|
21
22
  make_url_and_add_breadcrumb(element, path, options)
@@ -80,9 +81,19 @@ module RailsBreadcrumbs
80
81
  end
81
82
 
82
83
  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)
84
+ name = options[:name].present? ? options[:name] : "name"
85
+ url = make_url_for(object, path, options)
86
+ send(:add_breadcrumb, object[name], url)
87
+ end
88
+
89
+ def make_url_for(object, path, options)
90
+ target = options[:target].present? ? options[:target] : object.class.name.underscore
91
+ url = path.to_s + "(#{target}: '#{object.slug}'"
92
+ options[:url_options].each_pair do |key, value|
93
+ url += ", #{key}: '#{value}'"
94
+ end
95
+ url += ")"
96
+ url
86
97
  end
87
98
  end
88
99
  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.6"
4
+ s.version = "0.5.7"
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.6
4
+ version: 0.5.7
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-12 00:00:00.000000000 Z
11
+ date: 2014-07-23 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: RailsBreadcrumbs is a gem that implements breadcrumbs.
14
14
  email: developers@majoron.com