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 +4 -4
- data/lib/crumbs/action_controller/base.rb +9 -20
- data/lib/crumbs/version.rb +1 -1
- data/test/dummy/config/application.rb +0 -1
- data/test/dummy/config/initializers/secret_token.rb +1 -0
- data/test/dummy/log/test.log +1424 -0
- metadata +15 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7f70ae6eeba2b20e9ee261ff06383f9df40b93e0
|
4
|
+
data.tar.gz: a386fbd54af37f2c1e0cc0d4657848e0e6a224a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
-
|
21
|
+
session[:referers] = session[:referers][0...index] + [referer]
|
21
22
|
elsif
|
22
|
-
|
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
|
data/lib/crumbs/version.rb
CHANGED
@@ -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'
|