avo 1.13.3 → 1.16.0
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 +1 -1
- data/Gemfile.lock +8 -10
- data/app/components/avo/fields/common/multiple_file_viewer_component.html.erb +14 -7
- data/app/components/avo/fields/common/single_file_viewer_component.html.erb +15 -7
- data/app/components/avo/fields/file_field/edit_component.html.erb +3 -1
- data/app/components/avo/fields/files_field/edit_component.html.erb +3 -1
- data/app/components/avo/index/resource_controls_component.rb +2 -2
- data/app/controllers/avo/application_controller.rb +22 -4
- data/app/controllers/avo/base_controller.rb +1 -1
- data/app/packs/js/controllers/text_filter_controller.js +23 -0
- data/app/views/avo/base/_text_filter.html.erb +23 -0
- data/lib/avo/app.rb +2 -0
- data/lib/avo/fields_collector.rb +1 -0
- data/lib/avo/filters/text_filter.rb +9 -0
- data/lib/avo/version.rb +1 -1
- data/public/avo-packs/css/application-2b4685ca.css.map +1 -1
- data/public/avo-packs/css/application-2b4685ca.css.map.br +0 -0
- data/public/avo-packs/css/application-2b4685ca.css.map.gz +0 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js +26 -0
- data/public/avo-packs/js/{application-6dbb940fca2e811fb7d5.js.LICENSE.txt → application-124d087ff9491dbf3511.js.LICENSE.txt} +0 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js.br +0 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js.gz +0 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map +1 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.br +0 -0
- data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +8 -8
- metadata +12 -9
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js +0 -26
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.br +0 -0
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.gz +0 -0
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map +0 -1
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map.br +0 -0
- data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map.gz +0 -0
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '058d74773e0381fcecf783cd8bebcb40324f6c2bab9de93c17d0f75b245319ba'
|
4
|
+
data.tar.gz: 8d5eba16f6aa0f07cb7215df8ef4b9e2c75bfc87cbdb64f24b5376d5068834a0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3619d803b275d81b9d67f6adcf8d8ad4025325f39f64d2c9f421c556879045e188a484d1596e033f28bede52857793ea4004ff4a32f3e3000c78af446acb8b6f
|
7
|
+
data.tar.gz: ec928e6cb7d34e001c269cefaf60c8172526249420deb4dac14266108d2d847f36bf2bf3ba4d0a53f6f978063dd76e0695eb568827719ba40d5a79319a2543dd
|
data/Gemfile
CHANGED
@@ -30,7 +30,7 @@ gem "rails", "~> 6.1.0"
|
|
30
30
|
# Use postgresql as the database for Active Record
|
31
31
|
gem "pg", ">= 0.18", "< 2.0"
|
32
32
|
# Use Puma as the app server
|
33
|
-
gem "puma", "~> 5.
|
33
|
+
gem "puma", "~> 5.5.1"
|
34
34
|
# Use SCSS for stylesheets
|
35
35
|
gem "sass-rails", ">= 6"
|
36
36
|
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (1.
|
4
|
+
avo (1.16.0)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -201,15 +201,13 @@ GEM
|
|
201
201
|
mime-types-data (3.2021.0225)
|
202
202
|
mini_magick (4.11.0)
|
203
203
|
mini_mime (1.0.3)
|
204
|
-
mini_portile2 (2.
|
204
|
+
mini_portile2 (2.6.1)
|
205
205
|
minitest (5.14.4)
|
206
206
|
msgpack (1.4.2)
|
207
207
|
multi_xml (0.6.0)
|
208
|
-
nio4r (2.5.
|
209
|
-
nokogiri (1.
|
210
|
-
mini_portile2 (~> 2.
|
211
|
-
racc (~> 1.4)
|
212
|
-
nokogiri (1.11.7-x86_64-linux)
|
208
|
+
nio4r (2.5.8)
|
209
|
+
nokogiri (1.12.5)
|
210
|
+
mini_portile2 (~> 2.6.1)
|
213
211
|
racc (~> 1.4)
|
214
212
|
orm_adapter (0.5.0)
|
215
213
|
pagy (4.11.0)
|
@@ -218,7 +216,7 @@ GEM
|
|
218
216
|
ast (~> 2.4.1)
|
219
217
|
pg (1.2.3)
|
220
218
|
public_suffix (4.0.6)
|
221
|
-
puma (5.
|
219
|
+
puma (5.5.1)
|
222
220
|
nio4r (~> 2.0)
|
223
221
|
pundit (2.1.0)
|
224
222
|
activesupport (>= 3.0.0)
|
@@ -417,7 +415,7 @@ DEPENDENCIES
|
|
417
415
|
manifester
|
418
416
|
meta-tags
|
419
417
|
pg (>= 0.18, < 2.0)
|
420
|
-
puma (~> 5.
|
418
|
+
puma (~> 5.5.1)
|
421
419
|
pundit
|
422
420
|
rails (~> 6.1.0)
|
423
421
|
rails-controller-testing
|
@@ -441,4 +439,4 @@ DEPENDENCIES
|
|
441
439
|
zeitwerk (~> 2.3)
|
442
440
|
|
443
441
|
BUNDLED WITH
|
444
|
-
2.2.
|
442
|
+
2.2.29
|
@@ -14,13 +14,20 @@
|
|
14
14
|
<% end %>
|
15
15
|
|
16
16
|
<div class="flex justify-between lg:flex-col lg:space-y-2 2xl:flex-row 2xl:space-y-0">
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
<div>
|
18
|
+
<% if @resource.authorization.authorize_action(:download_attachments?, raise_exception: false) %>
|
19
|
+
<%= a_link helpers.main_app.url_for(@file), color: 'indigo', download: true, class: 'text-center', size: :xs do %>
|
20
|
+
<%= helpers.svg 'download' %> <span class="hidden lg:block lg:flex-1"><%= t('avo.download_file') %></span>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<div>
|
25
|
+
<% if @resource.authorization.authorize_action(:delete_attachments?, raise_exception: false) %>
|
26
|
+
<%= a_link "#{Avo::App.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id}/active_storage_attachments/#{@id}/#{@file.id}", color: :red, variant: :outlined, size: :xs, class: 'text-center', 'data-turbo-frame': 'destroy_attachment_form', data: { confirm: t('avo.are_you_sure')} do %>
|
27
|
+
<%= helpers.svg 'trash' %> <span class="hidden lg:block lg:flex-1"><%= t 'avo.delete_file', item: @file.filename %></span>
|
28
|
+
<% end %>
|
29
|
+
<% end %>
|
30
|
+
</div>
|
24
31
|
</div>
|
25
32
|
<% end %>
|
26
33
|
</div>
|
@@ -14,13 +14,21 @@
|
|
14
14
|
<% end %>
|
15
15
|
|
16
16
|
<div class="flex justify-between">
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
<div>
|
18
|
+
<% if @resource.authorization.authorize_action(:download_attachments?, raise_exception: false) %>
|
19
|
+
<%= a_link helpers.main_app.url_for(@file), color: 'indigo', download: true, class: '', size: :md do %>
|
20
|
+
<%= helpers.svg 'download' %> <%= t('avo.download_file') %>
|
21
|
+
<% end %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
<div>
|
25
|
+
<% if @resource.authorization.authorize_action(:delete_attachments?, raise_exception: false) %>
|
26
|
+
<%= a_link "#{Avo::App.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id
|
27
|
+
}/active_storage_attachments/#{@id}/#{@file.blob_id}", color: :red, variant: :outlined, size: :md, class: '', 'data-turbo-frame': 'destroy_attachment_form', data: { confirm: t('avo.are_you_sure')} do %>
|
28
|
+
<%= helpers.svg 'trash' %> <%= t 'avo.delete_file', item: @file.filename %>
|
29
|
+
<% end %>
|
30
|
+
<% end %>
|
31
|
+
</div>
|
24
32
|
</div>
|
25
33
|
<% else %>
|
26
34
|
–
|
@@ -5,5 +5,7 @@
|
|
5
5
|
</div>
|
6
6
|
<% end %>
|
7
7
|
|
8
|
-
|
8
|
+
<% if @resource.authorization.authorize_action(:upload_attachments?, raise_exception: false) %>
|
9
|
+
<%= @form.file_field @field.id, disabled: @field.readonly %>
|
10
|
+
<% end %>
|
9
11
|
<% end %>
|
@@ -1,5 +1,7 @@
|
|
1
1
|
<%= edit_field_wrapper field: @field, index: @index, form: @form, resource: @resource, displayed_in_modal: @displayed_in_modal, full_width: true do %>
|
2
2
|
<%= render Avo::Fields::Common::FilesListViewerComponent.new(field: @field, resource: @resource) if @field.value.present? %>
|
3
3
|
|
4
|
-
|
4
|
+
<% if @resource.authorization.authorize_action(:upload_attachments?, raise_exception: false) %>
|
5
|
+
<%= @form.file_field @field.id, disabled: @field.readonly, multiple: true %>
|
6
|
+
<% end %>
|
5
7
|
<% end %>
|
@@ -24,7 +24,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
24
24
|
|
25
25
|
def show_path
|
26
26
|
if @parent_model.present?
|
27
|
-
helpers.resource_path(@resource.model, via_resource_class: @parent_model.class, via_resource_id: @parent_model.id)
|
27
|
+
helpers.resource_path(@resource.model, via_resource_class: @parent_model.class.base_class, via_resource_id: @parent_model.id)
|
28
28
|
else
|
29
29
|
helpers.resource_path(@resource.model)
|
30
30
|
end
|
@@ -32,7 +32,7 @@ class Avo::Index::ResourceControlsComponent < Avo::ResourceComponent
|
|
32
32
|
|
33
33
|
def edit_path
|
34
34
|
if @parent_model.present?
|
35
|
-
helpers.edit_resource_path(@resource.model, via_resource_class: @parent_model.class, via_resource_id: @parent_model.id)
|
35
|
+
helpers.edit_resource_path(@resource.model, via_resource_class: @parent_model.class.base_class, via_resource_id: @parent_model.id)
|
36
36
|
else
|
37
37
|
helpers.edit_resource_path(@resource.model)
|
38
38
|
end
|
@@ -97,9 +97,9 @@ module Avo
|
|
97
97
|
end
|
98
98
|
|
99
99
|
def resource_path(model = nil, resource_id: nil, keep_query_params: false, **args)
|
100
|
-
return avo.send :"resources_#{model
|
100
|
+
return avo.send :"resources_#{singular_name(model)}_path", resource_id, **args if resource_id.present?
|
101
101
|
|
102
|
-
avo.send :"resources_#{model
|
102
|
+
avo.send :"resources_#{singular_name(model)}_path", model, **args
|
103
103
|
end
|
104
104
|
|
105
105
|
def resource_attach_path(model_name, model_id, related_name, related_id = nil)
|
@@ -119,11 +119,11 @@ module Avo
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def new_resource_path(model, **args)
|
122
|
-
avo.send :"new_resources_#{model
|
122
|
+
avo.send :"new_resources_#{singular_name(model)}_path", **args
|
123
123
|
end
|
124
124
|
|
125
125
|
def edit_resource_path(model, **args)
|
126
|
-
avo.send :"edit_resources_#{model
|
126
|
+
avo.send :"edit_resources_#{singular_name(model)}_path", model.id, **args
|
127
127
|
end
|
128
128
|
|
129
129
|
private
|
@@ -283,5 +283,23 @@ module Avo
|
|
283
283
|
def on_api_path
|
284
284
|
request.original_url.match?(/.*#{Avo::App.root_path}\/avo_api\/.*/)
|
285
285
|
end
|
286
|
+
|
287
|
+
def get_model_class(model)
|
288
|
+
if model.instance_of?(Class)
|
289
|
+
model
|
290
|
+
else
|
291
|
+
model.class
|
292
|
+
end
|
293
|
+
end
|
294
|
+
|
295
|
+
def singular_name(model_or_class)
|
296
|
+
model_class = get_model_class model_or_class
|
297
|
+
|
298
|
+
if ActiveModel::Naming.uncountable? model_class
|
299
|
+
model_class.model_name.route_key.singularize.gsub('_index', '')
|
300
|
+
else
|
301
|
+
model_class.model_name.route_key.singularize
|
302
|
+
end
|
303
|
+
end
|
286
304
|
end
|
287
305
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
import BaseFilterController from './filter_controller'
|
2
|
+
|
3
|
+
export default class extends BaseFilterController {
|
4
|
+
static targets = ['text']
|
5
|
+
|
6
|
+
getFilterValue() {
|
7
|
+
return this.textTarget.value
|
8
|
+
}
|
9
|
+
|
10
|
+
tryToSubmit(e) {
|
11
|
+
if (e.keyCode === 13) {
|
12
|
+
return this.changeFilter()
|
13
|
+
}
|
14
|
+
|
15
|
+
return undefined
|
16
|
+
}
|
17
|
+
|
18
|
+
getFilterClass() {
|
19
|
+
const { filterClass } = this.textTarget.dataset
|
20
|
+
|
21
|
+
return filterClass
|
22
|
+
}
|
23
|
+
}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%
|
2
|
+
begin
|
3
|
+
decoded_filters_param = JSON.parse(Base64.decode64(params[:filters]))
|
4
|
+
set_value = decoded_filters_param[filter.class.to_s]
|
5
|
+
rescue => exception
|
6
|
+
set_value = filter.default
|
7
|
+
end
|
8
|
+
%>
|
9
|
+
<div data-controller="text-filter">
|
10
|
+
<%= filter_wrapper name: filter.name do %>
|
11
|
+
<%= text_field_tag filter.id, set_value,
|
12
|
+
class: input_classes('w-full mb-0'),
|
13
|
+
id: "avo_filters_#{filter.id.parameterize.underscore}",
|
14
|
+
'data-filter-class': filter.class.to_s,
|
15
|
+
'data-text-filter-target': 'text',
|
16
|
+
'data-action': 'keypress->text-filter#tryToSubmit'
|
17
|
+
%>
|
18
|
+
<div class="flex justify-end">
|
19
|
+
<%= a_button filter.button_label || "Filter by #{filter.name}", class: 'mt-4', color: 'blue', data: { action: "text-filter#changeFilter" }, size: :sm %>
|
20
|
+
</div>
|
21
|
+
<%= link_to 'url_redirect', request.url, data: { 'text-filter-target': 'urlRedirect', 'turbo-frame': params[:turbo_frame] }, style: 'hidden', class: 'hidden' %>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
data/lib/avo/app.rb
CHANGED
data/lib/avo/fields_collector.rb
CHANGED
data/lib/avo/version.rb
CHANGED