effective_resources 0.9.2 → 0.9.3
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 97f5af01059a5104a7aab55be99f8e727ed3bd31
|
4
|
+
data.tar.gz: 520f3b843b594d7a0b3526c375db09ac05ec8934
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48f46cdbb4729669c9b242a766f4fe81cef54c48645510901aee4a5bdc94a9ca4abfe38bdb25826a9bff70d38abf3a7122e139c20d2d35de03674c373732fe5d
|
7
|
+
data.tar.gz: f53e42dc35f09c651d16a4e230af29af2ac2bef204e052e7d654eaeafa2ec14dcbad246d50a41f66cb19b8391770dbe8998d8fa60320d9c067ddf5a442e2d639
|
@@ -56,16 +56,10 @@ module EffectiveResourcesHelper
|
|
56
56
|
partial = atts.delete(:partial)
|
57
57
|
spacer_template = locals.delete(:spacer_template)
|
58
58
|
|
59
|
-
partial =
|
60
|
-
|
61
|
-
partial
|
62
|
-
when Symbol
|
63
|
-
['effective/resource/actions'.freeze, partial.to_s].join('_')
|
64
|
-
else
|
65
|
-
'effective/resource/actions'.freeze
|
66
|
-
end + '.html'.freeze
|
59
|
+
partial = ['effective/resource/actions', partial.to_s].join('_') if partial.kind_of?(Symbol)
|
60
|
+
partial = (partial.presence || 'effective/resource/actions') + '.html'
|
67
61
|
|
68
|
-
actions = (instance ? resource.member_get_actions : resource.collection_get_actions)
|
62
|
+
actions = (instance ? (resource.member_get_actions + resource.member_delete_actions) : resource.collection_get_actions)
|
69
63
|
actions = (actions & resource.crud_actions) if atts.delete(:crud)
|
70
64
|
|
71
65
|
raise "unknown action for #{resource.name}: #{(atts.keys - actions).join(' ')}." if (atts.keys - actions).present?
|
@@ -73,7 +67,7 @@ module EffectiveResourcesHelper
|
|
73
67
|
|
74
68
|
locals = { resource: instance, effective_resource: resource, namespace: namespace, actions: actions }.compact.merge(locals)
|
75
69
|
|
76
|
-
if instance.kind_of?(Array)
|
70
|
+
if instance.kind_of?(Array)
|
77
71
|
render(partial: partial, collection: instance, as: :resource, locals: locals.except(:resource), spacer_template: spacer_template)
|
78
72
|
elsif block_given?
|
79
73
|
render(partial, locals) { yield }
|
@@ -96,6 +96,10 @@ module Effective
|
|
96
96
|
routes.values.map { |route| route.defaults[:action].to_sym if is_member_route?(route) && is_get_route?(route) }.compact
|
97
97
|
end
|
98
98
|
|
99
|
+
def member_delete_actions
|
100
|
+
routes.values.map { |route| route.defaults[:action].to_sym if is_member_route?(route) && is_delete_route?(route) }.compact
|
101
|
+
end
|
102
|
+
|
99
103
|
# POST/PUT/PATCH actions
|
100
104
|
def member_post_actions
|
101
105
|
routes.values.map { |route| route.defaults[:action].to_sym if is_member_route?(route) && is_post_route?(route) }.compact
|
@@ -120,6 +124,10 @@ module Effective
|
|
120
124
|
route.verb.to_s.include?('GET')
|
121
125
|
end
|
122
126
|
|
127
|
+
def is_delete_route?(route)
|
128
|
+
route.verb.to_s.include?('DELETE')
|
129
|
+
end
|
130
|
+
|
123
131
|
def is_post_route?(route)
|
124
132
|
['POST', 'PUT', 'PATCH'].any? { |verb| route.verb == verb }
|
125
133
|
end
|
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: 0.9.
|
4
|
+
version: 0.9.3
|
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: 2018-
|
11
|
+
date: 2018-08-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|