avo 2.5.2.pre.3 → 2.5.2.pre.4
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 -3
- data/app/assets/builds/avo.css +0 -8
- data/app/controllers/avo/associations_controller.rb +2 -2
- data/app/controllers/avo/search_controller.rb +2 -2
- data/app/views/layouts/avo/application.html.erb +3 -0
- data/lib/avo/fields/belongs_to_field.rb +4 -4
- data/lib/avo/fields/has_base_field.rb +2 -0
- data/lib/avo/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: 22511d72c9065fbb776ed546dd2522554cdface044c11d6418b81807a32793f5
|
4
|
+
data.tar.gz: 4bd69e6ec75df792913f43dcd2e39d892cf5299e596647e78545cc7bf49fac03
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1d16808f6a6a533e1fd4b942fb303a8c5af1286a245bd532e1a71bcf2f9302f548c49bc9e50821e4cfc1b1cb92388e3d92f0dc7dba3cfb38c2b957aab3e0f984
|
7
|
+
data.tar.gz: c063076faed31f2d712a7c44e76db798ac99e7f37ae18fb4132217ac7980d6da8b79ecaae2b4ea5d526e1cccd0b4688694c4010375c549ad6850bcc039d3088b
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (2.5.2.pre.
|
4
|
+
avo (2.5.2.pre.4)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -248,8 +248,6 @@ GEM
|
|
248
248
|
nokogiri (1.13.4)
|
249
249
|
mini_portile2 (~> 2.8.0)
|
250
250
|
racc (~> 1.4)
|
251
|
-
nokogiri (1.13.4-x86_64-linux)
|
252
|
-
racc (~> 1.4)
|
253
251
|
orm_adapter (0.5.0)
|
254
252
|
pagy (5.10.1)
|
255
253
|
activesupport
|
data/app/assets/builds/avo.css
CHANGED
@@ -46,8 +46,8 @@ module Avo
|
|
46
46
|
query = @authorization.apply_policy @attachment_class
|
47
47
|
|
48
48
|
# Add the association scope to the query scope
|
49
|
-
if @field.
|
50
|
-
query = Avo::Hosts::AssociationScopeHost.new(block: @field.
|
49
|
+
if @field.attach_scope.present?
|
50
|
+
query = Avo::Hosts::AssociationScopeHost.new(block: @field.attach_scope, query: query, parent: @model).handle
|
51
51
|
end
|
52
52
|
|
53
53
|
@options = query.all.map do |model|
|
@@ -51,12 +51,12 @@ module Avo
|
|
51
51
|
# Fetch the field
|
52
52
|
field = belongs_to_field
|
53
53
|
|
54
|
-
if field.
|
54
|
+
if field.attach_scope.present?
|
55
55
|
# Fetch the parent
|
56
56
|
parent = params[:via_reflection_class].safe_constantize.find params[:via_reflection_id]
|
57
57
|
|
58
58
|
# Add to the query
|
59
|
-
query = Avo::Hosts::AssociationScopeHost.new(block: belongs_to_field.
|
59
|
+
query = Avo::Hosts::AssociationScopeHost.new(block: belongs_to_field.attach_scope, query: query, parent: parent).handle
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
@@ -50,5 +50,8 @@
|
|
50
50
|
<% end %>
|
51
51
|
<%= render partial: "avo/partials/scripts" %>
|
52
52
|
<!-- Avo version: <%= Avo::VERSION %> -->
|
53
|
+
<!-- Environment: <%= Rails.env %> -->
|
54
|
+
<!-- License ID: <%= Avo::App.license.id %> -->
|
55
|
+
<!-- License valid?: <%= Avo::App.license.valid ? "valid" : "invalid" %> -->
|
53
56
|
</body>
|
54
57
|
</html>
|
@@ -62,7 +62,7 @@ module Avo
|
|
62
62
|
attr_reader :relation_method
|
63
63
|
attr_reader :types # for Polymorphic associations
|
64
64
|
attr_reader :allow_via_detaching
|
65
|
-
attr_reader :
|
65
|
+
attr_reader :attach_scope
|
66
66
|
attr_reader :polymorphic_help
|
67
67
|
|
68
68
|
def initialize(id, **args, &block)
|
@@ -75,7 +75,7 @@ module Avo
|
|
75
75
|
@types = args[:types]
|
76
76
|
@relation_method = id.to_s.parameterize.underscore
|
77
77
|
@allow_via_detaching = args[:allow_via_detaching] == true
|
78
|
-
@
|
78
|
+
@attach_scope = args[:attach_scope]
|
79
79
|
@polymorphic_help = args[:polymorphic_help]
|
80
80
|
end
|
81
81
|
|
@@ -117,8 +117,8 @@ module Avo
|
|
117
117
|
|
118
118
|
query = Avo::Services::AuthorizationService.apply_policy(user, resource.class.query_scope)
|
119
119
|
|
120
|
-
if
|
121
|
-
query = Avo::Hosts::AssociationScopeHost.new(block:
|
120
|
+
if attach_scope.present?
|
121
|
+
query = Avo::Hosts::AssociationScopeHost.new(block: attach_scope, query: query, parent: get_model).handle
|
122
122
|
end
|
123
123
|
|
124
124
|
query.all.map do |model|
|
@@ -3,12 +3,14 @@ module Avo
|
|
3
3
|
class HasBaseField < BaseField
|
4
4
|
attr_accessor :display
|
5
5
|
attr_accessor :scope
|
6
|
+
attr_accessor :attach_scope
|
6
7
|
attr_accessor :description
|
7
8
|
|
8
9
|
def initialize(id, **args, &block)
|
9
10
|
super(id, **args, &block)
|
10
11
|
|
11
12
|
@scope = args[:scope].present? ? args[:scope] : nil
|
13
|
+
@attach_scope = args[:attach_scope].present? ? args[:attach_scope] : nil
|
12
14
|
@display = args[:display].present? ? args[:display] : :show
|
13
15
|
@searchable = args[:searchable] == true
|
14
16
|
@description = args[:description]
|
data/lib/avo/version.rb
CHANGED