avo 1.15.0.pre.1 → 1.16.2

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.

Files changed (27) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -4
  3. data/app/components/avo/index/resource_controls_component.rb +2 -2
  4. data/app/components/avo/views/resource_show_component.html.erb +5 -0
  5. data/app/packs/js/controllers/text_filter_controller.js +23 -0
  6. data/app/views/avo/base/_text_filter.html.erb +23 -0
  7. data/lib/avo/app.rb +1 -3
  8. data/lib/avo/filters/text_filter.rb +9 -0
  9. data/lib/avo/version.rb +1 -1
  10. data/public/avo-packs/css/application-2b4685ca.css.map +1 -1
  11. data/public/avo-packs/css/application-2b4685ca.css.map.br +0 -0
  12. data/public/avo-packs/css/application-2b4685ca.css.map.gz +0 -0
  13. data/public/avo-packs/js/application-124d087ff9491dbf3511.js +26 -0
  14. data/public/avo-packs/js/{application-6dbb940fca2e811fb7d5.js.LICENSE.txt → application-124d087ff9491dbf3511.js.LICENSE.txt} +0 -0
  15. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.br +0 -0
  16. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.gz +0 -0
  17. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map +1 -0
  18. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.br +0 -0
  19. data/public/avo-packs/js/application-124d087ff9491dbf3511.js.map.gz +0 -0
  20. data/public/avo-packs/manifest.json +8 -8
  21. metadata +14 -11
  22. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js +0 -26
  23. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.br +0 -0
  24. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.gz +0 -0
  25. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map +0 -1
  26. data/public/avo-packs/js/application-6dbb940fca2e811fb7d5.js.map.br +0 -0
  27. 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: d383ac646109d2df17ad55051991565b86751396b90f07bed6febd2c74ec2a3b
4
- data.tar.gz: 165d98536e64218b88b4cd4e3191cabf1ccda0469d3bd85d84d1498097c1404f
3
+ metadata.gz: 391b29088645004eb4d4f3c2f6bc01ab86695aaf85f4d076004b08730ab2f8ff
4
+ data.tar.gz: d062bfc791119e31a8c3868cfe2842b3835a4bfc52668a6252e5f7c85fe064e0
5
5
  SHA512:
6
- metadata.gz: d3981465a470c93bef51cea94d4fe2b1cd3473e0e07bcbd5e7bdd2dcc7749d14ad9560fe2b46794e8e41a4554725cefaab61b68908ede56d3f6cf1bda54d42b7
7
- data.tar.gz: c96ee899de497fa540760abab565bbca84b4d40b074159e73403661604fefffa3bca342bbf8407c07a27bbaad0c95d3c2cf5f1dccd4f72376b3ce73a508d7c5f
6
+ metadata.gz: e8c30ba4c563d73564be81cdc2391f0a1f88cb435aff55ba1e01ac196c835d9e77ffbf265a7ef1a9721dc91569dbb5744af3d3c72688ebf2e5453b12b4edf644
7
+ data.tar.gz: 1525ced018fb96312cd7317e424124e31021dbf37b42c505aecce07ac151a1a27a932fdc9553ceb882ba434db877fa3f2f3dd0f6dd6ca92094304eee986649bc
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.15.0.pre.1)
4
+ avo (1.16.2)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -209,8 +209,6 @@ GEM
209
209
  nokogiri (1.12.5)
210
210
  mini_portile2 (~> 2.6.1)
211
211
  racc (~> 1.4)
212
- nokogiri (1.12.5-x86_64-linux)
213
- racc (~> 1.4)
214
212
  orm_adapter (0.5.0)
215
213
  pagy (4.11.0)
216
214
  parallel (1.20.1)
@@ -441,4 +439,4 @@ DEPENDENCIES
441
439
  zeitwerk (~> 2.3)
442
440
 
443
441
  BUNDLED WITH
444
- 2.2.17
442
+ 2.2.29
@@ -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
@@ -14,6 +14,11 @@
14
14
  <%= svg 'trash' %> <%= t('avo.detach_item', item: @reflection.name.to_s).capitalize %>
15
15
  <% end %>
16
16
  <% end %>
17
+ <% if @resource.authorization.authorize_action(:edit, raise_exception: false) %>
18
+ <%= a_link edit_path, color: 'indigo' do %>
19
+ <%= svg 'edit' %> <%= t('avo.edit').capitalize %>
20
+ <% end %>
21
+ <% end %>
17
22
  <% else %>
18
23
  <%= a_link back_path do %>
19
24
  <%= svg 'arrow-left' %> <%= t('avo.go_back') %>
@@ -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
@@ -164,13 +164,11 @@ module Avo
164
164
  end
165
165
  .map do |resource|
166
166
  route_key = if resource.model_class.present?
167
- resource.model_class.model_name.route_key
167
+ resource.model_class.model_name.plural.to_sym
168
168
  else
169
169
  resource.to_s.underscore.gsub("_resource", "").downcase.pluralize.to_sym
170
170
  end
171
171
 
172
- # Handle uncountable routes
173
- route_key = route_key.to_sym
174
172
  resources route_key
175
173
  end
176
174
  end
@@ -0,0 +1,9 @@
1
+ module Avo
2
+ module Filters
3
+ class TextFilter < BaseFilter
4
+ class_attribute :button_label
5
+
6
+ self.template = "avo/base/text_filter"
7
+ end
8
+ end
9
+ end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.15.0.pre.1"
2
+ VERSION = "1.16.2"
3
3
  end