avo 1.7.2 → 1.7.3.pre.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.

Files changed (51) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +3 -1
  3. data/Gemfile.lock +90 -69
  4. data/app/components/avo/fields/common/multiple_file_viewer_component.html.erb +1 -1
  5. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +1 -1
  6. data/app/components/avo/fields/file_field/index_component.html.erb +1 -1
  7. data/app/components/avo/fields/trix_field/edit_component.html.erb +3 -0
  8. data/app/components/avo/index/grid_item_component.html.erb +4 -6
  9. data/app/components/avo/views/resource_index_component.rb +1 -1
  10. data/app/controllers/avo/application_controller.rb +11 -9
  11. data/app/controllers/avo/search_controller.rb +3 -1
  12. data/app/packs/js/controllers/fields/trix_field_controller.js +16 -0
  13. data/app/views/avo/actions/show.html.erb +1 -1
  14. data/app/views/avo/attachments/show.html.erb +1 -1
  15. data/app/views/avo/base/_actions.html.erb +2 -2
  16. data/app/views/avo/home/index.html.erb +2 -2
  17. data/app/views/avo/partials/_javascript.html.erb +1 -1
  18. data/app/views/avo/partials/_resource_search.html.erb +1 -1
  19. data/app/views/avo/relations/new.html.erb +1 -1
  20. data/app/views/avo/sidebar/_sidebar.html.erb +1 -1
  21. data/lib/avo/app.rb +3 -1
  22. data/lib/avo/base_resource.rb +3 -1
  23. data/lib/avo/configuration.rb +7 -1
  24. data/lib/avo/fields/file_field.rb +0 -8
  25. data/lib/avo/fields/has_and_belongs_to_many_field.rb +4 -4
  26. data/lib/avo/fields/has_many_field.rb +4 -4
  27. data/lib/avo/fields/has_one_field.rb +4 -4
  28. data/lib/avo/fields/trix_field.rb +6 -0
  29. data/lib/avo/version.rb +1 -1
  30. data/lib/generators/avo/field_generator.rb +1 -1
  31. data/lib/generators/avo/install_generator.rb +1 -1
  32. data/lib/generators/avo/templates/initializer/avo.tt +1 -0
  33. data/lib/generators/avo/templates/tool/sidebar_item.tt +1 -1
  34. data/public/avo-packs/css/application-797341b7.css.map +1 -1
  35. data/public/avo-packs/css/application-797341b7.css.map.br +0 -0
  36. data/public/avo-packs/css/application-797341b7.css.map.gz +0 -0
  37. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js +26 -0
  38. data/public/avo-packs/js/{application-2a4345ecd9464d1e8850.js.LICENSE.txt → application-651ed7b9bc727c83f673.js.LICENSE.txt} +0 -0
  39. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.br +0 -0
  40. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.gz +0 -0
  41. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map +1 -0
  42. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map.br +0 -0
  43. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map.gz +0 -0
  44. data/public/avo-packs/manifest.json +8 -8
  45. metadata +11 -11
  46. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js +0 -26
  47. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js.br +0 -0
  48. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js.gz +0 -0
  49. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js.map +0 -1
  50. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js.map.br +0 -0
  51. data/public/avo-packs/js/application-2a4345ecd9464d1e8850.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 76e6f84b0b7d8c9144994b898621dd99359875e7a32e26865c86034431031992
4
- data.tar.gz: 8df9ac786016d2ba0ef2ca2071a4d9e3445a6d3e0db3d55fa4ac12aa49d1fe79
3
+ metadata.gz: e96f8c7b1a99eebd33b9062e2cc6af6a57318c3fad731efe977a14f223e4a85a
4
+ data.tar.gz: 2c6fef93d648146d920eefe4cf4e63077f93b38197416e78e2cf5974877f1578
5
5
  SHA512:
6
- metadata.gz: 0ef42c3022b80c94f2fa5543321a737d7c89fe4a57ee81493fdd3c9cd068184c8107873985e9df3a0d8d33fef2ccf664f7bd70094349925a6b04f94375cb0e92
7
- data.tar.gz: 68fa168d75070ff5dd08f6b5643ecf9efa73a003b5fb3968bb8b784594553cf76043a8598397cb6a392fcae958865f52f530126df3825df3f132656dbfe3b770
6
+ metadata.gz: 0c8db63eaf4002fb720624beba6e87f1251da632e51a1c589ae0c2501111adea74b250c04f02d9f4e9479c138d364ab7082950393807821bc45c7d1977061e93
7
+ data.tar.gz: 1a065511c9883fc0d350bbfa65315f1483745d6324059b484f89cea75bdbb86473f24344dbbb9ebffd2cc442296438eb00df8e011ebd661c1399aa1e5d701937
data/Gemfile CHANGED
@@ -26,7 +26,7 @@ gem "pundit"
26
26
  # Dependencies for dummy_app
27
27
  #
28
28
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
29
- gem "rails", "~> 6.0.2", ">= 6.0.2.2"
29
+ 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
@@ -128,3 +128,5 @@ gem 'breadcrumbs_on_rails'
128
128
  gem 'manifester'
129
129
 
130
130
  gem 'ransack'
131
+
132
+ gem "aws-sdk-s3", require: false
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.7.2)
4
+ avo (1.7.3.pre.1)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -21,38 +21,40 @@ PATH
21
21
  GEM
22
22
  remote: https://rubygems.org/
23
23
  specs:
24
- actioncable (6.0.3.7)
25
- actionpack (= 6.0.3.7)
24
+ actioncable (6.1.3.2)
25
+ actionpack (= 6.1.3.2)
26
+ activesupport (= 6.1.3.2)
26
27
  nio4r (~> 2.0)
27
28
  websocket-driver (>= 0.6.1)
28
- actionmailbox (6.0.3.7)
29
- actionpack (= 6.0.3.7)
30
- activejob (= 6.0.3.7)
31
- activerecord (= 6.0.3.7)
32
- activestorage (= 6.0.3.7)
33
- activesupport (= 6.0.3.7)
29
+ actionmailbox (6.1.3.2)
30
+ actionpack (= 6.1.3.2)
31
+ activejob (= 6.1.3.2)
32
+ activerecord (= 6.1.3.2)
33
+ activestorage (= 6.1.3.2)
34
+ activesupport (= 6.1.3.2)
34
35
  mail (>= 2.7.1)
35
- actionmailer (6.0.3.7)
36
- actionpack (= 6.0.3.7)
37
- actionview (= 6.0.3.7)
38
- activejob (= 6.0.3.7)
36
+ actionmailer (6.1.3.2)
37
+ actionpack (= 6.1.3.2)
38
+ actionview (= 6.1.3.2)
39
+ activejob (= 6.1.3.2)
40
+ activesupport (= 6.1.3.2)
39
41
  mail (~> 2.5, >= 2.5.4)
40
42
  rails-dom-testing (~> 2.0)
41
- actionpack (6.0.3.7)
42
- actionview (= 6.0.3.7)
43
- activesupport (= 6.0.3.7)
44
- rack (~> 2.0, >= 2.0.8)
43
+ actionpack (6.1.3.2)
44
+ actionview (= 6.1.3.2)
45
+ activesupport (= 6.1.3.2)
46
+ rack (~> 2.0, >= 2.0.9)
45
47
  rack-test (>= 0.6.3)
46
48
  rails-dom-testing (~> 2.0)
47
49
  rails-html-sanitizer (~> 1.0, >= 1.2.0)
48
- actiontext (6.0.3.7)
49
- actionpack (= 6.0.3.7)
50
- activerecord (= 6.0.3.7)
51
- activestorage (= 6.0.3.7)
52
- activesupport (= 6.0.3.7)
50
+ actiontext (6.1.3.2)
51
+ actionpack (= 6.1.3.2)
52
+ activerecord (= 6.1.3.2)
53
+ activestorage (= 6.1.3.2)
54
+ activesupport (= 6.1.3.2)
53
55
  nokogiri (>= 1.8.5)
54
- actionview (6.0.3.7)
55
- activesupport (= 6.0.3.7)
56
+ actionview (6.1.3.2)
57
+ activesupport (= 6.1.3.2)
56
58
  builder (~> 3.1)
57
59
  erubi (~> 1.4)
58
60
  rails-dom-testing (~> 2.0)
@@ -60,25 +62,27 @@ GEM
60
62
  active_link_to (1.0.5)
61
63
  actionpack
62
64
  addressable
63
- activejob (6.0.3.7)
64
- activesupport (= 6.0.3.7)
65
+ activejob (6.1.3.2)
66
+ activesupport (= 6.1.3.2)
65
67
  globalid (>= 0.3.6)
66
- activemodel (6.0.3.7)
67
- activesupport (= 6.0.3.7)
68
- activerecord (6.0.3.7)
69
- activemodel (= 6.0.3.7)
70
- activesupport (= 6.0.3.7)
71
- activestorage (6.0.3.7)
72
- actionpack (= 6.0.3.7)
73
- activejob (= 6.0.3.7)
74
- activerecord (= 6.0.3.7)
68
+ activemodel (6.1.3.2)
69
+ activesupport (= 6.1.3.2)
70
+ activerecord (6.1.3.2)
71
+ activemodel (= 6.1.3.2)
72
+ activesupport (= 6.1.3.2)
73
+ activestorage (6.1.3.2)
74
+ actionpack (= 6.1.3.2)
75
+ activejob (= 6.1.3.2)
76
+ activerecord (= 6.1.3.2)
77
+ activesupport (= 6.1.3.2)
75
78
  marcel (~> 1.0.0)
76
- activesupport (6.0.3.7)
79
+ mini_mime (~> 1.0.2)
80
+ activesupport (6.1.3.2)
77
81
  concurrent-ruby (~> 1.0, >= 1.0.2)
78
- i18n (>= 0.7, < 2)
79
- minitest (~> 5.1)
80
- tzinfo (~> 1.1)
81
- zeitwerk (~> 2.2, >= 2.2.2)
82
+ i18n (>= 1.6, < 2)
83
+ minitest (>= 5.1)
84
+ tzinfo (~> 2.0)
85
+ zeitwerk (~> 2.3)
82
86
  addressable (2.7.0)
83
87
  public_suffix (>= 2.0.2, < 5.0)
84
88
  appraisal (2.4.0)
@@ -86,6 +90,22 @@ GEM
86
90
  rake
87
91
  thor (>= 0.14.0)
88
92
  ast (2.4.2)
93
+ aws-eventstream (1.1.1)
94
+ aws-partitions (1.465.0)
95
+ aws-sdk-core (3.114.1)
96
+ aws-eventstream (~> 1, >= 1.0.2)
97
+ aws-partitions (~> 1, >= 1.239.0)
98
+ aws-sigv4 (~> 1.1)
99
+ jmespath (~> 1.0)
100
+ aws-sdk-kms (1.43.0)
101
+ aws-sdk-core (~> 3, >= 3.112.0)
102
+ aws-sigv4 (~> 1.1)
103
+ aws-sdk-s3 (1.95.1)
104
+ aws-sdk-core (~> 3, >= 3.112.0)
105
+ aws-sdk-kms (~> 1)
106
+ aws-sigv4 (~> 1.1)
107
+ aws-sigv4 (1.2.3)
108
+ aws-eventstream (~> 1, >= 1.0.2)
89
109
  bcrypt (3.1.16)
90
110
  bindex (0.8.1)
91
111
  bootsnap (1.7.3)
@@ -157,6 +177,7 @@ GEM
157
177
  i18n
158
178
  jbuilder (2.10.1)
159
179
  activesupport (>= 5.0.0)
180
+ jmespath (1.4.0)
160
181
  launchy (2.5.0)
161
182
  addressable (~> 2.7)
162
183
  listen (3.5.1)
@@ -178,16 +199,16 @@ GEM
178
199
  mime-types-data (~> 3.2015)
179
200
  mime-types-data (3.2021.0225)
180
201
  mini_magick (4.11.0)
181
- mini_mime (1.1.0)
182
- mini_portile2 (2.5.1)
202
+ mini_mime (1.0.3)
203
+ mini_portile2 (2.5.3)
183
204
  minitest (5.14.4)
184
205
  msgpack (1.4.2)
185
206
  multi_xml (0.6.0)
186
207
  nio4r (2.5.7)
187
- nokogiri (1.11.5)
208
+ nokogiri (1.11.7)
188
209
  mini_portile2 (~> 2.5.0)
189
210
  racc (~> 1.4)
190
- nokogiri (1.11.5-x86_64-linux)
211
+ nokogiri (1.11.7-x86_64-linux)
191
212
  racc (~> 1.4)
192
213
  orm_adapter (0.5.0)
193
214
  pagy (3.13.0)
@@ -206,20 +227,20 @@ GEM
206
227
  rack
207
228
  rack-test (1.1.0)
208
229
  rack (>= 1.0, < 3)
209
- rails (6.0.3.7)
210
- actioncable (= 6.0.3.7)
211
- actionmailbox (= 6.0.3.7)
212
- actionmailer (= 6.0.3.7)
213
- actionpack (= 6.0.3.7)
214
- actiontext (= 6.0.3.7)
215
- actionview (= 6.0.3.7)
216
- activejob (= 6.0.3.7)
217
- activemodel (= 6.0.3.7)
218
- activerecord (= 6.0.3.7)
219
- activestorage (= 6.0.3.7)
220
- activesupport (= 6.0.3.7)
221
- bundler (>= 1.3.0)
222
- railties (= 6.0.3.7)
230
+ rails (6.1.3.2)
231
+ actioncable (= 6.1.3.2)
232
+ actionmailbox (= 6.1.3.2)
233
+ actionmailer (= 6.1.3.2)
234
+ actionpack (= 6.1.3.2)
235
+ actiontext (= 6.1.3.2)
236
+ actionview (= 6.1.3.2)
237
+ activejob (= 6.1.3.2)
238
+ activemodel (= 6.1.3.2)
239
+ activerecord (= 6.1.3.2)
240
+ activestorage (= 6.1.3.2)
241
+ activesupport (= 6.1.3.2)
242
+ bundler (>= 1.15.0)
243
+ railties (= 6.1.3.2)
223
244
  sprockets-rails (>= 2.0.0)
224
245
  rails-controller-testing (1.0.5)
225
246
  actionpack (>= 5.0.1.rc1)
@@ -230,12 +251,12 @@ GEM
230
251
  nokogiri (>= 1.6)
231
252
  rails-html-sanitizer (1.3.0)
232
253
  loofah (~> 2.3)
233
- railties (6.0.3.7)
234
- actionpack (= 6.0.3.7)
235
- activesupport (= 6.0.3.7)
254
+ railties (6.1.3.2)
255
+ actionpack (= 6.1.3.2)
256
+ activesupport (= 6.1.3.2)
236
257
  method_source
237
258
  rake (>= 0.8.7)
238
- thor (>= 0.20.3, < 2.0)
259
+ thor (~> 1.0)
239
260
  rainbow (3.0.0)
240
261
  rake (13.0.3)
241
262
  ransack (2.4.2)
@@ -325,19 +346,18 @@ GEM
325
346
  rails (>= 6.0.0)
326
347
  test-prof (0.12.2)
327
348
  thor (1.1.0)
328
- thread_safe (0.3.6)
329
349
  tilt (2.0.10)
330
350
  turbo-rails (0.5.9)
331
351
  rails (>= 6.0.0)
332
- tzinfo (1.2.9)
333
- thread_safe (~> 0.1)
352
+ tzinfo (2.0.4)
353
+ concurrent-ruby (~> 1.0)
334
354
  unicode-display_width (2.0.0)
335
355
  unicode_utils (1.4.0)
336
- view_component (2.32.0)
356
+ view_component (2.33.0)
337
357
  activesupport (>= 5.0.0, < 7.0)
338
358
  warden (1.2.9)
339
359
  rack (>= 2.0.9)
340
- web-console (4.0.4)
360
+ web-console (4.1.0)
341
361
  actionview (>= 6.0.0)
342
362
  activemodel (>= 6.0.0)
343
363
  bindex (>= 0.4.0)
@@ -355,7 +375,7 @@ GEM
355
375
  rack-proxy (>= 0.6.1)
356
376
  railties (>= 5.2)
357
377
  semantic_range (>= 2.3.0)
358
- websocket-driver (0.7.3)
378
+ websocket-driver (0.7.4)
359
379
  websocket-extensions (>= 0.1.0)
360
380
  websocket-extensions (0.1.5)
361
381
  xpath (3.2.0)
@@ -371,6 +391,7 @@ DEPENDENCIES
371
391
  addressable
372
392
  appraisal
373
393
  avo!
394
+ aws-sdk-s3
374
395
  bootsnap (>= 1.4.2)
375
396
  breadcrumbs_on_rails
376
397
  bump
@@ -396,7 +417,7 @@ DEPENDENCIES
396
417
  pg (>= 0.18, < 2.0)
397
418
  puma (~> 5.3.1)
398
419
  pundit
399
- rails (~> 6.0.2, >= 6.0.2.2)
420
+ rails (~> 6.1.0)
400
421
  rails-controller-testing
401
422
  ransack
402
423
  rspec-rails (~> 4.0.0)
@@ -17,7 +17,7 @@
17
17
  <%= a_link helpers.main_app.url_for(@file), color: 'indigo', download: true, class: 'text-center', size: :xs do %>
18
18
  <%= helpers.svg 'download' %> <span class="hidden lg:block lg:flex-1"><%= t('avo.download_file') %></span>
19
19
  <% end %>
20
- <%= a_link "#{Avo.configuration.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id
20
+ <%= a_link "#{Avo::App.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id
21
21
  }/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 %>
22
22
  <%= helpers.svg 'trash' %> <span class="hidden lg:block lg:flex-1"><%= t 'avo.delete_file', item: @file.filename %></span>
23
23
  <% end %>
@@ -17,7 +17,7 @@
17
17
  <%= a_link helpers.main_app.url_for(@file), color: 'indigo', download: true, class: '', size: :md do %>
18
18
  <%= helpers.svg 'download' %> <%= t('avo.download_file') %>
19
19
  <% end %>
20
- <%= a_link "#{Avo.configuration.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id
20
+ <%= a_link "#{Avo::App.root_path}/resources/#{@resource.model.model_name.route_key}/#{@resource.model.id
21
21
  }/active_storage_attachments/#{@id}/#{@file.id}", color: :red, variant: :outlined, size: :md, class: '', 'data-turbo-frame': 'destroy_attachment_form', data: { confirm: t('avo.are_you_sure')} do %>
22
22
  <%= helpers.svg 'trash' %> <%= t 'avo.delete_file', item: @file.filename %>
23
23
  <% end %>
@@ -1,7 +1,7 @@
1
1
  <%= index_field_wrapper field: @field do %>
2
2
  <% if @field.value.present? %>
3
3
  <% if @field.value.attached? && @field.value.representable? && @field.is_image %>
4
- <%= link_to_if @field.link_to_resource, image_tag(@field.variant, class: 'max-h-full'), resource_path, class: 'block h-8' %>
4
+ <%= link_to_if @field.link_to_resource, image_tag(helpers.main_app.url_for(@field.value), class: 'max-h-full'), resource_path, class: 'block h-8' %>
5
5
  <% else %>
6
6
  <%= @field.value.filename %>
7
7
  <% end %>
@@ -6,6 +6,9 @@
6
6
  data-resource-id="<%= @resource.model.id %>"
7
7
  data-attachments-disabled="<%= @field.attachments_disabled %>"
8
8
  data-attachment-key="<%= @field.attachment_key %>"
9
+ data-hide-attachment-filename="<%= @field.hide_attachment_filename %>"
10
+ data-hide-attachment-filesize="<%= @field.hide_attachment_filesize %>"
11
+ data-hide-attachment-url="<%= @field.hide_attachment_url %>"
9
12
  >
10
13
  <% trix_id = "trix_#{@resource.name.underscore}_#{@field.id}" %>
11
14
  <trix-editor data-trix-field-target="editor" input="<%= trix_id %>" placeholder="<%= @field.placeholder %>"><%== @field.value %></trix-editor>
@@ -10,18 +10,16 @@
10
10
  <%= link_to_if cover.link_to_resource, image_tag(cover.to_image, class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
11
11
  <% elsif cover.type == 'file' %>
12
12
  <% if cover.value.attached? && cover.value.representable? %>
13
- <%= link_to_if cover.link_to_resource, image_tag(cover.variant(resize_to_limit: [480, 480]), class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
13
+ <%= link_to_if cover.link_to_resource, image_tag(helpers.main_app.url_for(cover.value.variant(resize_to_limit: [480, 480])), class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
14
14
  <% else %>
15
15
  <div class="absolute bg-gray-100 w-full h-full">
16
16
  <%= helpers.svg 'avocado', class: 'relative transform -translate-x-1/2 -translate-y-1/2 h-20 text-gray-400 inset-auto top-1/2 left-1/2' %>
17
17
  </div>
18
18
  <% end %>
19
+ <% elsif cover.value.present? %>
20
+ <%= link_to_if cover.link_to_resource, image_tag(cover.value, class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
19
21
  <% else %>
20
- <% if cover.value.present? %>
21
- <%= link_to_if cover.link_to_resource, image_tag(cover.value, class: 'absolute h-full w-full object-cover'), helpers.resource_path(@resource.model), class: 'absolute h-full w-full object-cover', title: title.value %>
22
- <% else %>
23
- <%= render Avo::Index::GridCoverEmptyStateComponent.new %>
24
- <% end %>
22
+ <%= render Avo::Index::GridCoverEmptyStateComponent.new %>
25
23
  <% end %>
26
24
  </div>
27
25
  <div class="grid grid-cols-1 place-content-between p-4 h-full">
@@ -77,7 +77,7 @@ class Avo::Views::ResourceIndexComponent < Avo::ResourceComponent
77
77
  end
78
78
 
79
79
  def attach_path
80
- "#{Avo.configuration.root_path}#{request.env["PATH_INFO"]}/new"
80
+ "#{Avo::App.root_path}#{request.env["PATH_INFO"]}/new"
81
81
  end
82
82
 
83
83
  def detach_path
@@ -17,7 +17,7 @@ module Avo
17
17
  add_flash_types :info, :warning, :success, :error
18
18
 
19
19
  def init_app
20
- Avo::App.init request: request, context: context, current_user: _current_user
20
+ Avo::App.init request: request, context: context, root_path: avo.root_path.delete_suffix("/"), current_user: _current_user
21
21
 
22
22
  @license = Avo::App.license
23
23
  end
@@ -78,6 +78,7 @@ module Avo
78
78
  existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
79
79
  end
80
80
  rescue; end
81
+
81
82
  avo.send :"resources_#{model.model_name.route_key}_path", **existing_params, **args
82
83
  end
83
84
 
@@ -91,7 +92,7 @@ module Avo
91
92
  existing_params = Addressable::URI.parse(request.fullpath).query_values.symbolize_keys
92
93
  end
93
94
  rescue; end
94
- Addressable::Template.new("#{Avo.configuration.root_path}/resources/#{@parent_resource.model.model_name.route_key}/#{@parent_resource.model.id}/#{@resource.route_key}{?query*}")
95
+ Addressable::Template.new("#{Avo::App.root_path}/resources/#{@parent_resource.model.model_name.route_key}/#{@parent_resource.model.id}/#{@resource.route_key}{?query*}")
95
96
  .expand({query: {**existing_params, **args}})
96
97
  .to_str
97
98
  end
@@ -103,7 +104,7 @@ module Avo
103
104
  end
104
105
 
105
106
  def resource_attach_path(model_name, model_id, related_name, related_id = nil)
106
- path = "#{Avo.configuration.root_path}/resources/#{model_name}/#{model_id}/#{related_name}/new"
107
+ path = "#{Avo::App.root_path}/resources/#{model_name}/#{model_id}/#{related_name}/new"
107
108
 
108
109
  path += "/#{related_id}" if related_id.present?
109
110
 
@@ -111,7 +112,7 @@ module Avo
111
112
  end
112
113
 
113
114
  def resource_detach_path(model_name, model_id, related_name, related_id = nil)
114
- path = "#{Avo.configuration.root_path}/resources/#{model_name}/#{model_id}/#{related_name}"
115
+ path = "#{Avo::App.root_path}/resources/#{model_name}/#{model_id}/#{related_name}"
115
116
 
116
117
  path += "/#{related_id}" if related_id.present?
117
118
 
@@ -147,7 +148,8 @@ module Avo
147
148
  end
148
149
 
149
150
  def set_model
150
- @model = eager_load_files(@resource, @resource.model_class).find params[:id]
151
+ # @model = eager_load_files(@resource, @resource.model_class).find params[:id]
152
+ @model = @resource.model_class.find params[:id]
151
153
  end
152
154
 
153
155
  def set_related_model
@@ -179,7 +181,7 @@ module Avo
179
181
 
180
182
  begin
181
183
  request.path
182
- .match(/\/?#{Avo.configuration.root_path.delete('/')}\/resources\/([a-z1-9\-_]*)\/?/mi)
184
+ .match(/\/?#{Avo::App.root_path.delete('/')}\/resources\/([a-z1-9\-_]*)\/?/mi)
183
185
  .captures
184
186
  .first
185
187
  rescue
@@ -273,15 +275,15 @@ module Avo
273
275
  end
274
276
 
275
277
  def on_root_path
276
- [Avo.configuration.root_path, "#{Avo.configuration.root_path}/"].include?(request.original_fullpath)
278
+ [Avo::App.root_path, "#{Avo::App.root_path}/"].include?(request.original_fullpath)
277
279
  end
278
280
 
279
281
  def on_resources_path
280
- request.original_url.match?(/.*#{Avo.configuration.root_path}\/resources\/.*/)
282
+ request.original_url.match?(/.*#{Avo::App.root_path}\/resources\/.*/)
281
283
  end
282
284
 
283
285
  def on_api_path
284
- request.original_url.match?(/.*#{Avo.configuration.root_path}\/avo_api\/.*/)
286
+ request.original_url.match?(/.*#{Avo::App.root_path}\/avo_api\/.*/)
285
287
  end
286
288
  end
287
289
  end