crumbs 1.1.0 → 1.1.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d7de3dbbb857eb4469756682e3ad60e55088e4d2
4
- data.tar.gz: 32c47f6e9baf0c2eea655548ec895832e7d1fca4
3
+ metadata.gz: 7f70ae6eeba2b20e9ee261ff06383f9df40b93e0
4
+ data.tar.gz: a386fbd54af37f2c1e0cc0d4657848e0e6a224a6
5
5
  SHA512:
6
- metadata.gz: 3863266a5fc2e73132384ed76e07c9b3efb7f515779a8e95351e7ee56e794241940604b6091e14ded0cd17f4461077d92c5fe040829d4d206c2731bebec4fcee
7
- data.tar.gz: 0954ec6072305b562961214bfbdc747e594d2546d010853da18f3071b4a74307e7ede34c84e4354c3fba0bb53bc851414b3d101391114a32ba3131d332031deb
6
+ metadata.gz: 3930d7d633e0acf5b7fd4076bd78c8aee1499a8578259df8c77726c22d35b07b80bdde6e38e56a3887d4ac0cb3bdd0fca22c07354c343f28957acdc4628beeaa
7
+ data.tar.gz: 6ccf8263cab04beaddb7319a1314542b9851473411506041e0a1ba0f8f68a2c3c14c6fc8ee7c35b94c0f6a7bfa653a40de73dbbb742920fda1fd1a706abfeaf2
@@ -12,14 +12,15 @@ module Crumbs
12
12
  def define_crumbs
13
13
  paths = [request.path]
14
14
  paths.unshift File.dirname(paths.first) until paths.first == '/'
15
- if referers.empty? or referers.last[:base_url] != request.base_url
16
- self.referers = [build_referer]
17
- elsif request.path.starts_with? "#{referers.last[:path]}/".squeeze('/')
18
- self.referers << build_referer
15
+ referer = { base_url: request.base_url, path: request.path, fullpath: request.fullpath }
16
+ if session[:referers].nil? or session[:referers].last[:base_url] != request.base_url
17
+ session[:referers] = [referer]
18
+ elsif request.path.starts_with? "#{session[:referers].last[:path]}/".squeeze('/')
19
+ session[:referers] << referer
19
20
  elsif index = find_referer_index(paths)
20
- self.referers = referers[0...index] + [build_referer]
21
+ session[:referers] = session[:referers][0...index] + [referer]
21
22
  elsif
22
- self.referers = [build_referer]
23
+ session[:referers] = [referer]
23
24
  end
24
25
  paths.pop unless Rails.application.config.crumbs.show_last
25
26
  @crumbs = []
@@ -27,28 +28,16 @@ module Crumbs
27
28
  params = Rails.application.routes.recognize_path("#{request.base_url}#{path}") rescue next
28
29
  if name = Crumbs::Definitions.find(params[:controller], params[:action], params)
29
30
  if index = find_referer_index(path)
30
- path = referers[index][:fullpath]
31
+ path = session[:referers][index][:fullpath]
31
32
  end
32
33
  @crumbs << { name: name, path: path }
33
34
  end
34
35
  end
35
36
  end
36
37
 
37
- def referers
38
- session[:referers] ||= []
39
- end
40
-
41
- def referers=(value)
42
- session[:referers] = value
43
- end
44
-
45
- def build_referer
46
- { base_url: request.base_url, path: request.path, fullpath: request.fullpath }
47
- end
48
-
49
38
  def find_referer_index(paths)
50
39
  paths = [paths] unless paths.is_a? Array
51
- referers.rindex { |referer| paths.include? referer[:path] }
40
+ session[:referers].rindex { |referer| paths.include? referer[:path] }
52
41
  end
53
42
 
54
43
  module ClassMethods
@@ -1,5 +1,5 @@
1
1
  module Crumbs
2
2
 
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.2'
4
4
 
5
5
  end
@@ -18,6 +18,5 @@ module Dummy
18
18
  # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
19
  # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
20
  # config.i18n.default_locale = :de
21
- I18n.enforce_available_locales = false
22
21
  end
23
22
  end
@@ -9,4 +9,5 @@
9
9
 
10
10
  # Make sure your secret_key_base is kept private
11
11
  # if you're sharing your code publicly.
12
+ Dummy::Application.config.secret_token = '28edcd2365d0715246f2caa9a823fc54ec456ece62b47803b7653c856abf94b9bf2b02439a447d7621e9afcc76e26d6616df31cb19f59a50a18f1591c0ce665a'
12
13
  Dummy::Application.config.secret_key_base = '28edcd2365d0715246f2caa9a823fc54ec456ece62b47803b7653c856abf94b9bf2b02439a447d7621e9afcc76e26d6616df31cb19f59a50a18f1591c0ce665a'