avo 2.36.0 → 2.36.1
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/components/avo/tab_switcher_component.rb +19 -22
- data/app/controllers/avo/base_controller.rb +11 -3
- data/app/controllers/avo/search_controller.rb +5 -0
- data/lib/avo/concerns/has_fields.rb +5 -1
- data/lib/avo/fields/field_extensions/visible_in_different_views.rb +1 -1
- data/lib/avo/tab.rb +4 -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: 6cfa65ccbc3c3192f2daa5822ca180639c84bac36bbc8f4a05e608fb73525c20
|
4
|
+
data.tar.gz: 5a4846161d7aee464404f83e57da20c9efcc5624a54433fba1cf2031240d0355
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 82f1ef921487a6cfb94214ea861344dd85445dba19c5fa6cb63073da50fb547ef6aaae7db40ecb533972f6cd4bfa220ff54f2188e5b4ce39c7238a4e0ecaaf20
|
7
|
+
data.tar.gz: 031be9135507031c5d203dde3aa1429e27f7faf0e5b80f8fc201c3e4853ec758b705121c27756189a38b70cc0bed107023083de58c3a2fda2194e0f7d2ece363
|
data/Gemfile.lock
CHANGED
@@ -63,32 +63,29 @@ class Avo::TabSwitcherComponent < Avo::BaseComponent
|
|
63
63
|
# Because the developer hasn't specified that it should be visible on edit views (with the show_on: :edit option),
|
64
64
|
# the field should not be visible in the item switcher either.
|
65
65
|
def visible_items
|
66
|
-
tabs.select do |
|
67
|
-
|
68
|
-
|
69
|
-
if
|
70
|
-
|
71
|
-
|
66
|
+
tabs.select do |tab|
|
67
|
+
next false if tab.items.blank?
|
68
|
+
next false if tab.is_field? && !tab.authorized?
|
69
|
+
next false if tab.has_a_single_item? && !single_item_visible?(tab.items.first)
|
70
|
+
next false if !tab.visible?
|
71
|
+
next false if !tab.visible_on?(view)
|
72
|
+
|
73
|
+
true
|
74
|
+
end
|
75
|
+
end
|
72
76
|
|
73
|
-
|
74
|
-
if item.items.count == 1 && first_item.is_field? && first_item.has_own_panel? && !first_item.visible_on?(view)
|
75
|
-
# Return nil if tab contians a has_many type of fields and it's hidden in current view
|
76
|
-
visible = false
|
77
|
-
end
|
77
|
+
private
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
def single_item_visible?(item)
|
80
|
+
# Item is visible if is not a field or don't have its own panel
|
81
|
+
return true if !item.is_field?
|
82
|
+
return true if !item.has_own_panel?
|
82
83
|
|
83
|
-
|
84
|
-
visible = item.visible?
|
85
|
-
end
|
84
|
+
return false if !item.visible_on?(view)
|
86
85
|
|
87
|
-
|
88
|
-
|
89
|
-
end
|
86
|
+
# If item is hydrated with the correct resource and is not authorized, it's not visible
|
87
|
+
return false if item.resource.present? && !item.authorized?
|
90
88
|
|
91
|
-
|
92
|
-
end
|
89
|
+
true
|
93
90
|
end
|
94
91
|
end
|
@@ -215,16 +215,24 @@ module Avo
|
|
215
215
|
|
216
216
|
def save_model
|
217
217
|
perform_action_and_record_errors do
|
218
|
-
|
218
|
+
save_model_action
|
219
219
|
end
|
220
220
|
end
|
221
221
|
|
222
|
+
def save_model_action
|
223
|
+
@model.save!
|
224
|
+
end
|
225
|
+
|
222
226
|
def destroy_model
|
223
227
|
perform_action_and_record_errors do
|
224
|
-
|
228
|
+
destroy_model_action
|
225
229
|
end
|
226
230
|
end
|
227
231
|
|
232
|
+
def destroy_model_action
|
233
|
+
@model.destroy!
|
234
|
+
end
|
235
|
+
|
228
236
|
def perform_action_and_record_errors(&block)
|
229
237
|
begin
|
230
238
|
succeeded = block.call
|
@@ -253,7 +261,7 @@ module Avo
|
|
253
261
|
end
|
254
262
|
|
255
263
|
def permitted_params
|
256
|
-
@resource.get_field_definitions.select(&:updatable).map(&:to_permitted_param).concat
|
264
|
+
@resource.get_field_definitions.select(&:updatable).map(&:to_permitted_param).concat(extra_params).uniq
|
257
265
|
end
|
258
266
|
|
259
267
|
def extra_params
|
@@ -112,8 +112,13 @@ module Avo
|
|
112
112
|
# This scope is applied if the search is being performed on a has_many association
|
113
113
|
def apply_has_many_scope
|
114
114
|
association_name = BaseResource.valid_association_name(parent, params[:via_association_id])
|
115
|
+
|
116
|
+
# Get association records
|
115
117
|
scope = parent.send(association_name)
|
116
118
|
|
119
|
+
# Apply policy scope if authorization is present
|
120
|
+
scope = resource.authorization&.apply_policy scope
|
121
|
+
|
117
122
|
Avo::Hosts::SearchScopeHost.new(block: @resource.search_query, params: params, scope: scope).handle
|
118
123
|
end
|
119
124
|
|
@@ -98,6 +98,10 @@ module Avo
|
|
98
98
|
if item.is_field?
|
99
99
|
fields << item
|
100
100
|
end
|
101
|
+
|
102
|
+
if item.is_row?
|
103
|
+
fields << extract_fields_from_items(tab)
|
104
|
+
end
|
101
105
|
end
|
102
106
|
|
103
107
|
fields.flatten
|
@@ -117,7 +121,7 @@ module Avo
|
|
117
121
|
thing.items.each do |item|
|
118
122
|
if item.is_field?
|
119
123
|
fields << item
|
120
|
-
elsif item.is_panel?
|
124
|
+
elsif item.is_panel? || item.is_row?
|
121
125
|
fields << extract_fields_from_items(item)
|
122
126
|
end
|
123
127
|
end
|
data/lib/avo/tab.rb
CHANGED
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.36.
|
4
|
+
version: 2.36.1
|
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: 2023-07-
|
12
|
+
date: 2023-07-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activerecord
|