effective_resources 1.2.5 → 1.2.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,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: a5581c1ca7e6f7a54decd9c6ea534aec3a9c61c4
|
4
|
+
data.tar.gz: ef4bbf6529ccff4299b90645e081379ef4953619
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a2d4d1a86fab8cfeb839226e621ac3c3be2b6818fb0d9d2e77e8da847e992ce44a46426b32c7f9c5b446f400152199446517ed122c13ca161d3b63c08befc3c5
|
7
|
+
data.tar.gz: 2a4d94ed4a0dc9f5f49c7c4ca29d6b84dd5946510b3be812e7bfd0a1dbeb43015484bdf51e605fd6f521705021216adf01b21b50cab992d1a92fdd63cfb8a3c3
|
@@ -6,6 +6,7 @@ module Effective
|
|
6
6
|
submit = commit_action(action)
|
7
7
|
redirect = submit[:redirect].respond_to?(:call) ? instance_exec(&submit[:redirect]) : submit[:redirect]
|
8
8
|
|
9
|
+
# If we have a specific redirect for it
|
9
10
|
commit_action_redirect = case redirect
|
10
11
|
when :index ; resource_index_path
|
11
12
|
when :edit ; resource_edit_path
|
@@ -14,29 +15,42 @@ module Effective
|
|
14
15
|
when :duplicate ; resource_duplicate_path
|
15
16
|
when :back ; referer_redirect_path
|
16
17
|
when :save ; [resource_edit_path, resource_show_path].compact.first
|
17
|
-
when Symbol ; resource_action_path(
|
18
|
+
when Symbol ; resource_action_path(redirect)
|
18
19
|
when String ; redirect
|
19
20
|
else ; nil
|
20
21
|
end
|
21
22
|
|
22
23
|
return commit_action_redirect if commit_action_redirect.present?
|
23
24
|
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
25
|
+
# If we have a magic name
|
26
|
+
commit_name_redirect = case params[:commit].to_s
|
27
|
+
when 'Save and Add New', 'Add New'
|
28
|
+
[resource_new_path, resource_index_path]
|
29
|
+
when 'Duplicate'
|
30
|
+
[resource_duplicate_path, resource_index_path]
|
31
|
+
when 'Continue', 'Save and Continue'
|
32
|
+
[resource_index_path]
|
33
|
+
else
|
34
|
+
[]
|
35
|
+
end.compact.first
|
36
|
+
|
37
|
+
return commit_name_redirect if commit_name_redirect.present?
|
38
|
+
|
39
|
+
# Otherwise consider the action
|
40
|
+
commit_default_redirect = case action
|
41
|
+
when :create
|
42
|
+
[resource_show_path, resource_edit_path, resource_index_path]
|
43
|
+
when :update
|
30
44
|
[resource_edit_path, resource_show_path, resource_index_path]
|
31
|
-
when
|
32
|
-
[
|
33
|
-
when 'Duplicate'
|
34
|
-
[resource_duplicate_path, resource_index_path]
|
35
|
-
when 'Continue', 'Save and Continue'
|
36
|
-
[resource_index_path]
|
45
|
+
when :destroy
|
46
|
+
[referer_redirect_path, resource_index_path]
|
37
47
|
else
|
38
48
|
[referer_redirect_path, resource_edit_path, resource_show_path, resource_index_path]
|
39
|
-
end.compact.first
|
49
|
+
end.compact.first
|
50
|
+
|
51
|
+
return commit_default_redirect if commit_default_redirect.present?
|
52
|
+
|
53
|
+
root_path
|
40
54
|
end
|
41
55
|
|
42
56
|
def referer_redirect_path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -111,7 +111,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
111
111
|
version: '0'
|
112
112
|
requirements: []
|
113
113
|
rubyforge_project:
|
114
|
-
rubygems_version: 2.
|
114
|
+
rubygems_version: 2.4.5.1
|
115
115
|
signing_key:
|
116
116
|
specification_version: 4
|
117
117
|
summary: Make any controller an effective resource controller.
|