five-two-nw-olivander 0.2.0.35 → 0.2.0.36
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 +4 -4
- data/app/helpers/olivander/application_helper.rb +8 -3
- data/lib/olivander/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20a2a1f0d91b619aa91cb6e5670939246a5471a40a1fdcc772934f11de447c7c
|
4
|
+
data.tar.gz: 010f45ad72e71c350fbbcf73385fe2b39b47458e613a7da714dfd9dd378a367d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7175c69a12f98b0b31e6525b87b8e51a2fe9a8c3a02b577617acfc741b184edcdd1323d896fe5317278a238ae71c97905e4f0a49270efdfa6ce837f6acd4ed14
|
7
|
+
data.tar.gz: 2fb042867661f164131bcdd36ebc74e8f7ed62e2711b20b2b0ee9f5c1290f85db9947ca8f745ca1cf1d3048bb4b901418c15337b014f9ce80564a8bd66a574af
|
@@ -36,8 +36,9 @@ module Olivander
|
|
36
36
|
end
|
37
37
|
|
38
38
|
def authorized_resource_actions(resource, for_action: :show)
|
39
|
+
action_klass = action_klass_for(resource)
|
39
40
|
action_resource = action_resource_for(resource)
|
40
|
-
raw_name =
|
41
|
+
raw_name = action_klass.name
|
41
42
|
plural_name = raw_name.demodulize.underscore.pluralize
|
42
43
|
routed_resource = Olivander::CurrentContext.application_context.route_builder.resources[plural_name.to_sym]
|
43
44
|
return [] if routed_resource.nil?
|
@@ -63,9 +64,13 @@ module Olivander
|
|
63
64
|
end
|
64
65
|
end
|
65
66
|
|
66
|
-
def
|
67
|
+
def action_klass_for(resource)
|
67
68
|
klazz = resource.is_a?(Class) ? resource : resource.class
|
68
|
-
klazz.respond_to?(:
|
69
|
+
klazz.respond_to?(:action_klass) ? klazz.action_klass : klazz
|
70
|
+
end
|
71
|
+
|
72
|
+
def action_resource_for(resource)
|
73
|
+
resource.respond_to?(:action_resource) ? resource.action_resource : resource
|
69
74
|
end
|
70
75
|
|
71
76
|
def authorized_resource_action?(action, resource, except = nil)
|
data/lib/olivander/version.rb
CHANGED