effective_resources 1.8.7 → 1.8.8
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
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7247ed4940067b7becde627b02de2ccc38e8fa425b0a43f1080e60b40b4c57dc
|
4
|
+
data.tar.gz: 38939264d4747f0d2f83a306c9d0fc4e474e6f6303dd612d47e40390a0cf0e8e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a42dba0d42144cae133a766cebe9192d0257e3a0610a4535c163311f193923c56b5b21c15a4643d842557945d66d5a68faac4c0b1934ec406ce99ef8e991d5ad
|
7
|
+
data.tar.gz: fd8659905534432f07004a55d072dab21ab2c87e9f374c4b54fef68d8bec93450f68637200d598c430575b72969e3d156a419bd349ca54eb6460f0412acda4cc
|
@@ -2,7 +2,7 @@ module Effective
|
|
2
2
|
module CrudController
|
3
3
|
module Paths
|
4
4
|
|
5
|
-
def resource_redirect_path(action
|
5
|
+
def resource_redirect_path(resource, action)
|
6
6
|
submit = commit_action(action)
|
7
7
|
redirect = submit[:redirect].respond_to?(:call) ? instance_exec(&submit[:redirect]) : submit[:redirect]
|
8
8
|
|
@@ -39,13 +39,29 @@ module Effective
|
|
39
39
|
# Otherwise consider the action
|
40
40
|
commit_default_redirect = case action
|
41
41
|
when :create
|
42
|
-
[
|
42
|
+
[
|
43
|
+
(resource_show_path if EffectiveResources.authorized?(self, :show, resource)),
|
44
|
+
(resource_edit_path if EffectiveResources.authorized?(self, :edit, resource)),
|
45
|
+
(resource_index_path if EffectiveResources.authorized?(self, :index, resource.class))
|
46
|
+
]
|
43
47
|
when :update
|
44
|
-
[
|
48
|
+
[
|
49
|
+
(resource_edit_path if EffectiveResources.authorized?(self, :edit, resource)),
|
50
|
+
(resource_show_path if EffectiveResources.authorized?(self, :show, resource)),
|
51
|
+
(resource_index_path if EffectiveResources.authorized?(self, :index, resource.class))
|
52
|
+
]
|
45
53
|
when :destroy
|
46
|
-
[
|
54
|
+
[
|
55
|
+
referer_redirect_path,
|
56
|
+
(resource_index_path if EffectiveResources.authorized?(self, :index, resource.class))
|
57
|
+
]
|
47
58
|
else
|
48
|
-
[
|
59
|
+
[
|
60
|
+
referer_redirect_path,
|
61
|
+
(resource_edit_path if EffectiveResources.authorized?(self, :edit, resource)),
|
62
|
+
(resource_show_path if EffectiveResources.authorized?(self, :show, resource)),
|
63
|
+
(resource_index_path if EffectiveResources.authorized?(self, :index, resource.class))
|
64
|
+
]
|
49
65
|
end.compact.first
|
50
66
|
|
51
67
|
return commit_default_redirect if commit_default_redirect.present?
|
@@ -10,12 +10,12 @@ module Effective
|
|
10
10
|
respond_to do |format|
|
11
11
|
format.html do
|
12
12
|
flash[:success] ||= resource_flash(:success, resource, action)
|
13
|
-
redirect_to(resource_redirect_path(action))
|
13
|
+
redirect_to(resource_redirect_path(resource, action))
|
14
14
|
end
|
15
15
|
|
16
16
|
format.js do
|
17
17
|
flash[:success] ||= resource_flash(:success, resource, action)
|
18
|
-
redirect_to(resource_redirect_path(action))
|
18
|
+
redirect_to(resource_redirect_path(resource, action))
|
19
19
|
end
|
20
20
|
end
|
21
21
|
elsif template_present?(action)
|
@@ -35,7 +35,7 @@ module Effective
|
|
35
35
|
respond_to do |format|
|
36
36
|
format.html do
|
37
37
|
flash[:success] ||= resource_flash(:success, resource, action)
|
38
|
-
redirect_to(resource_redirect_path(action))
|
38
|
+
redirect_to(resource_redirect_path(resource, action))
|
39
39
|
end
|
40
40
|
|
41
41
|
format.js do
|
@@ -61,7 +61,7 @@ module Effective
|
|
61
61
|
when :destroy
|
62
62
|
format.html do
|
63
63
|
redirect_flash
|
64
|
-
redirect_to(resource_redirect_path(action))
|
64
|
+
redirect_to(resource_redirect_path(resource, action))
|
65
65
|
end
|
66
66
|
else
|
67
67
|
if template_present?(action)
|
@@ -73,7 +73,7 @@ module Effective
|
|
73
73
|
else
|
74
74
|
format.html do
|
75
75
|
redirect_flash
|
76
|
-
redirect_to(resource_redirect_path(action))
|
76
|
+
redirect_to(resource_redirect_path(resource, action))
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|