avo 1.7.1 → 1.8.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 (59) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +5 -1
  3. data/Gemfile.lock +94 -70
  4. data/README.md +11 -0
  5. data/app/components/avo/fields/common/multiple_file_viewer_component.html.erb +1 -1
  6. data/app/components/avo/fields/common/single_file_viewer_component.html.erb +1 -1
  7. data/app/components/avo/fields/file_field/index_component.html.erb +1 -1
  8. data/app/components/avo/fields/trix_field/edit_component.html.erb +3 -0
  9. data/app/components/avo/index/grid_item_component.html.erb +4 -6
  10. data/app/components/avo/views/resource_index_component.html.erb +48 -46
  11. data/app/components/avo/views/resource_index_component.rb +1 -1
  12. data/app/controllers/avo/actions_controller.rb +2 -2
  13. data/app/controllers/avo/application_controller.rb +11 -10
  14. data/app/controllers/avo/base_controller.rb +20 -4
  15. data/app/controllers/avo/relations_controller.rb +1 -1
  16. data/app/controllers/avo/search_controller.rb +11 -8
  17. data/app/packs/js/controllers/fields/trix_field_controller.js +16 -0
  18. data/app/views/avo/actions/show.html.erb +1 -1
  19. data/app/views/avo/attachments/show.html.erb +1 -1
  20. data/app/views/avo/base/_actions.html.erb +2 -2
  21. data/app/views/avo/home/index.html.erb +2 -2
  22. data/app/views/avo/partials/_javascript.html.erb +1 -1
  23. data/app/views/avo/partials/_resource_search.html.erb +1 -1
  24. data/app/views/avo/relations/new.html.erb +1 -1
  25. data/app/views/avo/sidebar/_sidebar.html.erb +1 -1
  26. data/config/initializers/friendly_id.rb +107 -0
  27. data/db/migrate/20210525143134_add_slug_to_users.rb +6 -0
  28. data/lib/avo/app.rb +3 -1
  29. data/lib/avo/base_resource.rb +23 -3
  30. data/lib/avo/configuration.rb +7 -1
  31. data/lib/avo/fields/belongs_to_field.rb +1 -1
  32. data/lib/avo/fields/file_field.rb +0 -8
  33. data/lib/avo/fields/has_and_belongs_to_many_field.rb +4 -4
  34. data/lib/avo/fields/has_many_field.rb +4 -4
  35. data/lib/avo/fields/has_one_field.rb +4 -4
  36. data/lib/avo/fields/trix_field.rb +6 -0
  37. data/lib/avo/version.rb +1 -1
  38. data/lib/generators/avo/field_generator.rb +1 -1
  39. data/lib/generators/avo/install_generator.rb +1 -1
  40. data/lib/generators/avo/templates/initializer/avo.tt +1 -0
  41. data/lib/generators/avo/templates/tool/sidebar_item.tt +1 -1
  42. data/public/avo-packs/css/application-797341b7.css.map +1 -1
  43. data/public/avo-packs/css/application-797341b7.css.map.br +0 -0
  44. data/public/avo-packs/css/application-797341b7.css.map.gz +0 -0
  45. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js +26 -0
  46. data/public/avo-packs/js/{application-947ed727440d5b5d73ab.js.LICENSE.txt → application-651ed7b9bc727c83f673.js.LICENSE.txt} +0 -0
  47. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.br +0 -0
  48. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.gz +0 -0
  49. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map +1 -0
  50. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map.br +0 -0
  51. data/public/avo-packs/js/application-651ed7b9bc727c83f673.js.map.gz +0 -0
  52. data/public/avo-packs/manifest.json +8 -8
  53. metadata +11 -9
  54. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js +0 -26
  55. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js.br +0 -0
  56. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js.gz +0 -0
  57. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js.map +0 -1
  58. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js.map.br +0 -0
  59. data/public/avo-packs/js/application-947ed727440d5b5d73ab.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 167094d8f361e32203e5310d37052c30b419985ef537961d2dba7df1b17d6af5
4
- data.tar.gz: e381cdd14247bc3c048ad291f2abeb0eb6c3879208a9b1c0cddf7115fa6190c7
3
+ metadata.gz: 4feab48191ab41e91301589afc3cc414f1b5d976fc77905c1f106480671c5d63
4
+ data.tar.gz: d4139d3f25ead157d4f90b1e9d4a6823958f7b473300ea2847f15cf398a5c58d
5
5
  SHA512:
6
- metadata.gz: 52cba011844d58a9fb7189008f6024c87908649e060405e9eae9a40ee33bcc35a72ecafed8749c67b9f434c55688ce134601fc8677c6e2452ca95971f960d50a
7
- data.tar.gz: d1b8109fbe59fffa44695db65c4e2de42879400165704f574fcc81577586560650996c12acd9e4b9325614223669bb0851d50a60c0697f19b426fd0be7d5ded8
6
+ metadata.gz: 8039fe1154cc5db8dd8efd5e9efa5f6f48f83aa66e511a3eb0ebdc57b75d90a436dcfd4206b525ad0a9854b6754b2ae9d7283b4740a1add1073b541bb220c48a
7
+ data.tar.gz: fdc9c69fc5f6c5bd4edc8b964f035dd5cc5d8adfe3f437a82adcf5f386013dfac17e0a89f7f72c1b4d782c65f63188326a3d2015cd0239f1028cdf93eabd791f
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,7 @@ gem 'breadcrumbs_on_rails'
128
128
  gem 'manifester'
129
129
 
130
130
  gem 'ransack'
131
+
132
+ gem 'friendly_id', '~> 5.4.0'
133
+
134
+ 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.1)
4
+ avo (1.8.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)
@@ -133,6 +153,8 @@ GEM
133
153
  faker (2.14.0)
134
154
  i18n (>= 1.6, < 2)
135
155
  ffi (1.15.0)
156
+ friendly_id (5.4.2)
157
+ activerecord (>= 4.0.0)
136
158
  fuubar (2.5.0)
137
159
  rspec-core (~> 3.0)
138
160
  ruby-progressbar (~> 1.4)
@@ -157,6 +179,7 @@ GEM
157
179
  i18n
158
180
  jbuilder (2.10.1)
159
181
  activesupport (>= 5.0.0)
182
+ jmespath (1.4.0)
160
183
  launchy (2.5.0)
161
184
  addressable (~> 2.7)
162
185
  listen (3.5.1)
@@ -178,19 +201,19 @@ GEM
178
201
  mime-types-data (~> 3.2015)
179
202
  mime-types-data (3.2021.0225)
180
203
  mini_magick (4.11.0)
181
- mini_mime (1.1.0)
182
- mini_portile2 (2.5.1)
204
+ mini_mime (1.0.3)
205
+ mini_portile2 (2.5.3)
183
206
  minitest (5.14.4)
184
207
  msgpack (1.4.2)
185
208
  multi_xml (0.6.0)
186
209
  nio4r (2.5.7)
187
- nokogiri (1.11.5)
210
+ nokogiri (1.11.7)
188
211
  mini_portile2 (~> 2.5.0)
189
212
  racc (~> 1.4)
190
- nokogiri (1.11.5-x86_64-linux)
213
+ nokogiri (1.11.7-x86_64-linux)
191
214
  racc (~> 1.4)
192
215
  orm_adapter (0.5.0)
193
- pagy (3.13.0)
216
+ pagy (4.8.0)
194
217
  parallel (1.20.1)
195
218
  parser (3.0.0.0)
196
219
  ast (~> 2.4.1)
@@ -206,20 +229,20 @@ GEM
206
229
  rack
207
230
  rack-test (1.1.0)
208
231
  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)
232
+ rails (6.1.3.2)
233
+ actioncable (= 6.1.3.2)
234
+ actionmailbox (= 6.1.3.2)
235
+ actionmailer (= 6.1.3.2)
236
+ actionpack (= 6.1.3.2)
237
+ actiontext (= 6.1.3.2)
238
+ actionview (= 6.1.3.2)
239
+ activejob (= 6.1.3.2)
240
+ activemodel (= 6.1.3.2)
241
+ activerecord (= 6.1.3.2)
242
+ activestorage (= 6.1.3.2)
243
+ activesupport (= 6.1.3.2)
244
+ bundler (>= 1.15.0)
245
+ railties (= 6.1.3.2)
223
246
  sprockets-rails (>= 2.0.0)
224
247
  rails-controller-testing (1.0.5)
225
248
  actionpack (>= 5.0.1.rc1)
@@ -230,12 +253,12 @@ GEM
230
253
  nokogiri (>= 1.6)
231
254
  rails-html-sanitizer (1.3.0)
232
255
  loofah (~> 2.3)
233
- railties (6.0.3.7)
234
- actionpack (= 6.0.3.7)
235
- activesupport (= 6.0.3.7)
256
+ railties (6.1.3.2)
257
+ actionpack (= 6.1.3.2)
258
+ activesupport (= 6.1.3.2)
236
259
  method_source
237
260
  rake (>= 0.8.7)
238
- thor (>= 0.20.3, < 2.0)
261
+ thor (~> 1.0)
239
262
  rainbow (3.0.0)
240
263
  rake (13.0.3)
241
264
  ransack (2.4.2)
@@ -325,19 +348,18 @@ GEM
325
348
  rails (>= 6.0.0)
326
349
  test-prof (0.12.2)
327
350
  thor (1.1.0)
328
- thread_safe (0.3.6)
329
351
  tilt (2.0.10)
330
352
  turbo-rails (0.5.9)
331
353
  rails (>= 6.0.0)
332
- tzinfo (1.2.9)
333
- thread_safe (~> 0.1)
354
+ tzinfo (2.0.4)
355
+ concurrent-ruby (~> 1.0)
334
356
  unicode-display_width (2.0.0)
335
357
  unicode_utils (1.4.0)
336
- view_component (2.32.0)
358
+ view_component (2.33.0)
337
359
  activesupport (>= 5.0.0, < 7.0)
338
360
  warden (1.2.9)
339
361
  rack (>= 2.0.9)
340
- web-console (4.0.4)
362
+ web-console (4.1.0)
341
363
  actionview (>= 6.0.0)
342
364
  activemodel (>= 6.0.0)
343
365
  bindex (>= 0.4.0)
@@ -355,7 +377,7 @@ GEM
355
377
  rack-proxy (>= 0.6.1)
356
378
  railties (>= 5.2)
357
379
  semantic_range (>= 2.3.0)
358
- websocket-driver (0.7.3)
380
+ websocket-driver (0.7.4)
359
381
  websocket-extensions (>= 0.1.0)
360
382
  websocket-extensions (0.1.5)
361
383
  xpath (3.2.0)
@@ -371,6 +393,7 @@ DEPENDENCIES
371
393
  addressable
372
394
  appraisal
373
395
  avo!
396
+ aws-sdk-s3
374
397
  bootsnap (>= 1.4.2)
375
398
  breadcrumbs_on_rails
376
399
  bump
@@ -382,6 +405,7 @@ DEPENDENCIES
382
405
  dotenv-rails
383
406
  factory_bot_rails
384
407
  faker
408
+ friendly_id (~> 5.4.0)
385
409
  fuubar
386
410
  gem-release
387
411
  hotwire-rails
@@ -396,7 +420,7 @@ DEPENDENCIES
396
420
  pg (>= 0.18, < 2.0)
397
421
  puma (~> 5.3.1)
398
422
  pundit
399
- rails (~> 6.0.2, >= 6.0.2.2)
423
+ rails (~> 6.1.0)
400
424
  rails-controller-testing
401
425
  ransack
402
426
  rspec-rails (~> 4.0.0)
data/README.md CHANGED
@@ -52,6 +52,10 @@ And then execute:
52
52
  $ bundle install
53
53
  ```
54
54
 
55
+ # Quick Purchase
56
+
57
+ Use [this](https://buy.stripe.com/9AQ6rX0uIbLF2CQdQQ) link to quickly purchase a Pro license to support this project. Thank you 🙏
58
+
55
59
  # Contributing
56
60
 
57
61
  Please read [CONTRIBUTING.MD](./CONTRIBUTING.MD)
@@ -59,3 +63,10 @@ Please read [CONTRIBUTING.MD](./CONTRIBUTING.MD)
59
63
  # Upgrade Guide
60
64
 
61
65
  Please read the [UPGRADE_GUIDE.MD](https://docs.avohq.io/1.0/upgrade.html)
66
+
67
+ # ✨ Contributors
68
+
69
+ <a href="https://github.com/avo-hq/avo/graphs/contributors">
70
+ <img src="https://contrib.rocks/image?repo=avo-hq/avo" />
71
+ </a>
72
+ <!-- https://contrib.rocks -->
@@ -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">
@@ -1,62 +1,64 @@
1
- <%= render Avo::PanelComponent.new(title: title, body_classes: 'py-4', data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?) do |c| %>
2
- <% c.tools do %>
3
- <%= render 'actions' if @actions.present? %>
1
+ <div>
2
+ <%= render Avo::PanelComponent.new(title: title, body_classes: 'py-4', data: { component: 'resources-index' }, display_breadcrumbs: @reflection.blank?) do |c| %>
3
+ <% c.tools do %>
4
+ <%= render 'actions' if @actions.present? %>
4
5
 
5
- <% if can_create? %>
6
- <%= a_link create_path do %>
7
- <%= svg 'plus' %> <%= t('avo.create_new_item', item: @resource.model_class.model_name.human.downcase ) %>
6
+ <% if can_create? %>
7
+ <%= a_link create_path do %>
8
+ <%= svg 'plus' %> <%= t('avo.create_new_item', item: @resource.model_class.model_name.human.downcase ) %>
9
+ <% end %>
8
10
  <% end %>
9
- <% end %>
10
11
 
11
- <% if can_detach? %>
12
- <%= a_link detach_path, color: 'indigo', method: :delete, data: { confirm: "Are you sure you want to detach this #{@resource.singular_name}." } do %>
13
- <%= svg 'trash' %> <%= t('avo.detach_item', item: @resource.singular_name).capitalize %>
12
+ <% if can_detach? %>
13
+ <%= a_link detach_path, color: 'indigo', method: :delete, data: { confirm: "Are you sure you want to detach this #{@resource.singular_name}." } do %>
14
+ <%= svg 'trash' %> <%= t('avo.detach_item', item: @resource.singular_name).capitalize %>
15
+ <% end %>
14
16
  <% end %>
15
- <% end %>
16
17
 
17
- <% if can_attach? %>
18
- <%= a_link attach_path, color: 'indigo', 'data-turbo-frame': 'attach_modal' do %>
19
- <%= svg 'view-grid-add' %> <%= t('avo.attach_item', item: @resource.singular_name).capitalize %>
18
+ <% if can_attach? %>
19
+ <%= a_link attach_path, color: 'indigo', 'data-turbo-frame': 'attach_modal' do %>
20
+ <%= svg 'view-grid-add' %> <%= t('avo.attach_item', item: @resource.singular_name).capitalize %>
21
+ <% end %>
20
22
  <% end %>
21
23
  <% end %>
22
- <% end %>
23
24
 
24
- <% c.body do %>
25
- <div class="flex justify-between pt-2 pb-2 min-h-16"
26
- data-selected-resources-name="<%= @resource.plural_name.downcase %>"
27
- data-selected-resources="[]"
28
- >
29
- <div class="flex items-center px-6 w-64">
30
- <%= render partial: 'avo/partials/resource_search', locals: {resource: @resource.route_key} if @resource.search_query.present? %>
31
- </div>
32
- <div class="flex justify-end items-center px-6 space-x-3">
33
- <%= render partial: 'avo/partials/view_toggle_button', locals: { available_view_types: available_view_types, view_type: view_type, turbo_frame: @turbo_frame } if @models.present? %>
34
- <%= render 'filters' if @filters.present? %>
35
- </div>
36
- </div>
37
-
38
- <% if view_type.to_sym == :table %>
39
- <div class="w-full overflow-auto flex flex-col mt-4">
40
- <div class="relative flex-1 flex">
41
- <%= render(Avo::Index::ResourceTableComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model)) %>
25
+ <% c.body do %>
26
+ <div class="flex justify-between pt-2 pb-2 min-h-16"
27
+ data-selected-resources-name="<%= @resource.plural_name.downcase %>"
28
+ data-selected-resources="[]"
29
+ >
30
+ <div class="flex items-center px-6 w-64">
31
+ <%= render partial: 'avo/partials/resource_search', locals: {resource: @resource.route_key} if @resource.search_query.present? %>
32
+ </div>
33
+ <div class="flex justify-end items-center px-6 space-x-3">
34
+ <%= render partial: 'avo/partials/view_toggle_button', locals: { available_view_types: available_view_types, view_type: view_type, turbo_frame: @turbo_frame } if @models.present? %>
35
+ <%= render 'filters' if @filters.present? %>
42
36
  </div>
37
+ </div>
43
38
 
44
- <% if @models.present? %>
45
- <div class="py-4">
46
- <%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
39
+ <% if view_type.to_sym == :table %>
40
+ <div class="w-full overflow-auto flex flex-col mt-4">
41
+ <div class="relative flex-1 flex">
42
+ <%= render(Avo::Index::ResourceTableComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model)) %>
47
43
  </div>
48
- <% end %>
49
- </div>
44
+
45
+ <% if @models.present? %>
46
+ <div class="py-4">
47
+ <%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
48
+ </div>
49
+ <% end %>
50
+ </div>
51
+ <% end %>
50
52
  <% end %>
51
- <% end %>
52
53
 
53
- <% c.bare_content do %>
54
- <% if view_type.to_sym == :grid %>
55
- <%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model) %>
54
+ <% c.bare_content do %>
55
+ <% if view_type.to_sym == :grid %>
56
+ <%= render Avo::Index::ResourceGridComponent.new(resources: @resources, resource: @resource, reflection: @reflection, parent_model: @parent_model) %>
56
57
 
57
- <div class="bg-white rounded-xl shadow-xl mt-8 py-6">
58
- <%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
59
- </div>
58
+ <div class="bg-white rounded-xl shadow-xl mt-8 py-6">
59
+ <%= render partial: 'avo/partials/paginator', locals: { pagy: @pagy, turbo_frame: @turbo_frame || 'none' } %>
60
+ </div>
61
+ <% end %>
60
62
  <% end %>
61
63
  <% end %>
62
- <% end %>
64
+ </div>