avo 2.21.1.pre.issue1444 → 2.21.1.pre.issue1450
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of avo might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/app/controllers/avo/application_controller.rb +2 -2
- data/app/controllers/avo/associations_controller.rb +1 -2
- data/app/controllers/avo/base_controller.rb +2 -2
- data/lib/avo/base_action.rb +3 -1
- data/lib/avo/fields/select_field.rb +1 -1
- data/lib/avo/filters/base_filter.rb +2 -1
- data/lib/avo/hosts/visibility_host.rb +1 -0
- data/lib/avo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ebf134b0ec573fefe33360ace54658cdaafcf1904a0d88f63e89398f12e34377
|
4
|
+
data.tar.gz: 4c1ccd709c542910c2590e4b508a549463d0777b33e3baff83a63e4c97a834f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e8bb307e086e09eb90b5cbfcddaee9f0f7fd4437ee742a98a0eaeea24171c68828dfa664a0076c332ce9df0955fb931bd3fe34c41941b4988ebe850d2e7cc682
|
7
|
+
data.tar.gz: e8169c3475feda95dcf85a9532c26b7157fe598e9544a033684fa343bb15aac0c68f5da776c7120a61d52dc2816ea84b7ac059444f4520e549aeaa09e694f017
|
data/Gemfile.lock
CHANGED
@@ -172,11 +172,11 @@ module Avo
|
|
172
172
|
end
|
173
173
|
|
174
174
|
def hydrate_resource
|
175
|
-
@resource.hydrate(view: action_name.to_sym, user: _current_user
|
175
|
+
@resource.hydrate(view: action_name.to_sym, user: _current_user)
|
176
176
|
end
|
177
177
|
|
178
178
|
def hydrate_related_resource
|
179
|
-
@related_resource.hydrate(view: action_name.to_sym, user: _current_user, model: @
|
179
|
+
@related_resource.hydrate(view: action_name.to_sym, user: _current_user, model: @model)
|
180
180
|
end
|
181
181
|
|
182
182
|
def authorize_base_action
|
@@ -3,13 +3,12 @@ require_dependency "avo/base_controller"
|
|
3
3
|
module Avo
|
4
4
|
class AssociationsController < BaseController
|
5
5
|
before_action :set_model, only: [:show, :index, :new, :create, :destroy, :order]
|
6
|
-
before_action :hydrate_resource, only: [:show, :index, :new, :create, :destroy, :order]
|
7
6
|
before_action :set_related_resource_name
|
8
7
|
before_action :set_related_resource, only: [:show, :index, :new, :create, :destroy, :order]
|
9
8
|
before_action :set_related_authorization
|
10
9
|
before_action :set_reflection_field
|
11
|
-
before_action :set_related_model, only: [:show, :order]
|
12
10
|
before_action :hydrate_related_resource, only: [:show, :index, :create, :destroy, :order]
|
11
|
+
before_action :set_related_model, only: [:show, :order]
|
13
12
|
before_action :set_reflection
|
14
13
|
before_action :set_attachment_class, only: [:show, :index, :new, :create, :destroy, :order]
|
15
14
|
before_action :set_attachment_resource, only: [:show, :index, :new, :create, :destroy, :order]
|
@@ -315,7 +315,7 @@ module Avo
|
|
315
315
|
filter[:class].new arguments: filter[:arguments]
|
316
316
|
end
|
317
317
|
.select do |filter|
|
318
|
-
filter.visible_in_view(resource: @resource, parent_resource: @parent_resource)
|
318
|
+
filter.visible_in_view(resource: @resource, parent_model: @parent_model, parent_resource: @parent_resource)
|
319
319
|
end
|
320
320
|
end
|
321
321
|
|
@@ -326,7 +326,7 @@ module Avo
|
|
326
326
|
action[:class].new(model: @model, resource: @resource, view: @view, arguments: action[:arguments])
|
327
327
|
end
|
328
328
|
.select do |action|
|
329
|
-
action.visible_in_view(parent_resource: @parent_resource)
|
329
|
+
action.visible_in_view(parent_model: @parent_model, parent_resource: @parent_resource)
|
330
330
|
end
|
331
331
|
end
|
332
332
|
|
data/lib/avo/base_action.rb
CHANGED
@@ -116,7 +116,7 @@ module Avo
|
|
116
116
|
self
|
117
117
|
end
|
118
118
|
|
119
|
-
def visible_in_view(parent_resource: nil)
|
119
|
+
def visible_in_view(parent_model: nil, parent_resource: nil)
|
120
120
|
if visible.blank?
|
121
121
|
# Hide on the :new view by default
|
122
122
|
return false if view == :new
|
@@ -128,7 +128,9 @@ module Avo
|
|
128
128
|
# Run the visible block if available
|
129
129
|
Avo::Hosts::VisibilityHost.new(
|
130
130
|
block: visible,
|
131
|
+
model: self.class.model,
|
131
132
|
params: params,
|
133
|
+
parent_model: parent_model,
|
132
134
|
parent_resource: parent_resource,
|
133
135
|
resource: self.class.resource,
|
134
136
|
view: self.class.view,
|
@@ -58,7 +58,7 @@ module Avo
|
|
58
58
|
|
59
59
|
# Cache options as options given on block or as options received from arguments
|
60
60
|
def options
|
61
|
-
|
61
|
+
if options_from_args.respond_to? :call
|
62
62
|
options_from_args.call model: model, resource: resource, view: view, field: self
|
63
63
|
else
|
64
64
|
options_from_args
|
@@ -60,13 +60,14 @@ module Avo
|
|
60
60
|
self.class.decode_filters params[PARAM_KEY]
|
61
61
|
end
|
62
62
|
|
63
|
-
def visible_in_view(resource: nil, parent_resource: nil)
|
63
|
+
def visible_in_view(resource: nil, parent_model: nil, parent_resource: nil)
|
64
64
|
return true if visible.blank?
|
65
65
|
|
66
66
|
# Run the visible block if available
|
67
67
|
Avo::Hosts::VisibilityHost.new(
|
68
68
|
block: visible,
|
69
69
|
params: params,
|
70
|
+
parent_model: parent_model,
|
70
71
|
parent_resource: parent_resource,
|
71
72
|
resource: resource,
|
72
73
|
arguments: arguments
|
data/lib/avo/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.21.1.pre.
|
4
|
+
version: 2.21.1.pre.issue1450
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adrian Marin
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-11-
|
12
|
+
date: 2022-11-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|