avo 2.17.1.pre.4.issue.1342 → 2.17.1.pre.5.stackedlayout

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +20 -9
  3. data/Gemfile.lock +78 -79
  4. data/app/components/avo/field_wrapper_component.html.erb +9 -11
  5. data/app/components/avo/field_wrapper_component.rb +10 -3
  6. data/app/components/avo/fields/date_field/edit_component.html.erb +6 -6
  7. data/app/components/avo/fields/date_time_field/edit_component.html.erb +6 -6
  8. data/app/components/avo/fields/edit_component.rb +1 -1
  9. data/app/components/avo/fields/show_component.rb +1 -1
  10. data/app/components/avo/fields/time_field/edit_component.html.erb +6 -6
  11. data/app/components/avo/index/resource_table_component.html.erb +1 -1
  12. data/app/components/avo/item_switcher_component.html.erb +4 -1
  13. data/app/components/avo/panel_component.html.erb +5 -2
  14. data/app/components/avo/views/resource_edit_component.html.erb +3 -1
  15. data/app/components/avo/views/resource_index_component.html.erb +3 -1
  16. data/app/components/avo/views/resource_show_component.html.erb +5 -2
  17. data/app/controllers/avo/actions_controller.rb +6 -5
  18. data/app/controllers/avo/cards_controller.rb +12 -2
  19. data/app/javascript/js/controllers/fields/date_field_controller.js +22 -21
  20. data/app/views/avo/actions/show.html.erb +1 -1
  21. data/app/views/avo/cards/chartkick_missing.html.erb +14 -0
  22. data/avo.gemspec +2 -5
  23. data/db/factories.rb +5 -5
  24. data/lib/avo/base_action.rb +1 -1
  25. data/lib/avo/base_resource.rb +1 -0
  26. data/lib/avo/concerns/can_replace_fields.rb +36 -0
  27. data/lib/avo/concerns/has_fields.rb +0 -25
  28. data/lib/avo/configuration.rb +3 -1
  29. data/lib/avo/engine.rb +10 -1
  30. data/lib/avo/fields/base_field.rb +2 -0
  31. data/lib/avo/fields/country_field.rb +5 -1
  32. data/lib/avo/html/builder.rb +14 -0
  33. data/lib/avo/services/authorization_clients/pundit_client.rb +7 -7
  34. data/lib/avo/services/authorization_service.rb +15 -14
  35. data/lib/avo/version.rb +1 -1
  36. data/lib/generators/avo/templates/initializer/avo.tt +2 -1
  37. data/public/avo-assets/avo.base.css +5 -0
  38. data/public/avo-assets/avo.base.js +1 -1
  39. data/public/avo-assets/avo.base.js.map +2 -2
  40. metadata +10 -50
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0cb67ed800f6808830e072dfeaf5acb53a9c8960d7ca1b1fc01a5ac27ab478b4
4
- data.tar.gz: 861965614539773f8c6242e211bb7e3449b8393ad2306cf3aa1bcbb030a36212
3
+ metadata.gz: ff184a72962903e95adcf3441d0e964f69d25664ea4c2b2e3581b520220339a2
4
+ data.tar.gz: f2eebedd7b8ec0eb879116109e47b772cdf66d2ece017f532a1bf920cd6a4813
5
5
  SHA512:
6
- metadata.gz: 5a2d565a8a5839e25f23cd4bdac2308c07a5b89dacadd090b8ddcaf5180b58fa4d7f844ebafbd02c167d60d9f0f5193c6b7cd2790c61f538fc8aadfa50e6f32b
7
- data.tar.gz: e1a6e356003227ff73440bd51a8aecdce3f4522be2c4cb0829fbd35a88d9916ffcb860638428f19296d66e054396f8683f759852282c22559b6f76fd415a8d81
6
+ metadata.gz: 6548dc91057871f9529223985d8b42b26dc6253af4b4f5c98fba3c73ec04f9db4ed2eeaae759b40e8884323e5ed62703c4e430bec15a95c703998885ae78af71
7
+ data.tar.gz: 8a47d790300bc6529cd143e6981630eb4f4077ef07b679c47132b0425e4b23e2310993466a0e761118e9cce1c633aa3af9ccf21dce30625089148f0f7976880b
data/Gemfile CHANGED
@@ -17,16 +17,12 @@ gemspec
17
17
  gem 'jsbundling-rails'
18
18
  gem 'cssbundling-rails'
19
19
 
20
- gem "countries"
21
-
22
- # Authorization
23
- gem "pundit"
24
-
25
20
  #
26
21
  # Dependencies for dummy_app
27
22
  #
28
23
  # Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
29
- gem "rails", "~> 6.1.0"
24
+ # gem "rails", "~> 6.1.0"
25
+
30
26
  # Use postgresql as the database for Active Record
31
27
  gem "pg", ">= 0.18", "< 2.0"
32
28
  # Use Puma as the app server
@@ -38,9 +34,6 @@ gem 'redis', '~> 4.0'
38
34
  # Use Active Model has_secure_password
39
35
  # gem 'bcrypt', '~> 3.1.7'
40
36
 
41
- # Use Active Storage variant
42
- gem "image_processing", "~> 1.12"
43
-
44
37
  # Reduces boot times through caching; required in config/boot.rb
45
38
  gem "bootsnap", ">= 1.4.2", require: false
46
39
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
@@ -109,6 +102,8 @@ group :test do
109
102
  gem "launchy", require: false
110
103
 
111
104
  gem "test-prof"
105
+
106
+ gem "sprockets-rails"
112
107
  end
113
108
 
114
109
  gem "rubocop"
@@ -153,3 +148,19 @@ gem 'acts-as-taggable-on', '~> 9.0'
153
148
  gem "bundler-integrity", "~> 1.0"
154
149
 
155
150
  gem 'erb-formatter'
151
+
152
+ # Avo authorization requires this gem
153
+ gem "pundit"
154
+
155
+ # Avo country field requires this gem
156
+ gem "countries"
157
+
158
+ # Avo dashbaords requires this gem
159
+ gem "chartkick"
160
+
161
+ # Avo file filed requires this gem
162
+ gem "activestorage"
163
+
164
+ # Avo file filed requires this gem
165
+ # Use Active Storage variant
166
+ gem "image_processing", "~> 1.12"
data/Gemfile.lock CHANGED
@@ -1,21 +1,18 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (2.17.1.pre.4.issue.1342)
4
+ avo (2.17.1.pre.5.stackedlayout)
5
+ actionview (>= 6.0)
5
6
  active_link_to
7
+ activerecord (>= 6.0)
6
8
  addressable
7
9
  breadcrumbs_on_rails
8
- chartkick
9
- countries
10
10
  docile
11
11
  dry-initializer
12
12
  httparty
13
- image_processing
14
13
  inline_svg
15
14
  meta-tags
16
15
  pagy
17
- pundit
18
- rails (>= 6.0)
19
16
  turbo-rails
20
17
  view_component
21
18
  zeitwerk
@@ -91,8 +88,8 @@ GEM
91
88
  activerecord (>= 6.0, < 7.1)
92
89
  acts_as_list (1.0.4)
93
90
  activerecord (>= 4.2)
94
- addressable (2.8.1)
95
- public_suffix (>= 2.0.2, < 6.0)
91
+ addressable (2.8.0)
92
+ public_suffix (>= 2.0.2, < 5.0)
96
93
  annotate (3.2.0)
97
94
  activerecord (>= 3.2, < 8.0)
98
95
  rake (>= 10.4, < 14.0)
@@ -103,22 +100,22 @@ GEM
103
100
  ast (2.4.2)
104
101
  awesome_print (1.9.2)
105
102
  aws-eventstream (1.2.0)
106
- aws-partitions (1.621.0)
107
- aws-sdk-core (3.134.0)
103
+ aws-partitions (1.551.0)
104
+ aws-sdk-core (3.125.5)
108
105
  aws-eventstream (~> 1, >= 1.0.2)
109
106
  aws-partitions (~> 1, >= 1.525.0)
110
107
  aws-sigv4 (~> 1.1)
111
- jmespath (~> 1, >= 1.6.1)
112
- aws-sdk-kms (1.58.0)
113
- aws-sdk-core (~> 3, >= 3.127.0)
108
+ jmespath (~> 1.0)
109
+ aws-sdk-kms (1.53.0)
110
+ aws-sdk-core (~> 3, >= 3.125.0)
114
111
  aws-sigv4 (~> 1.1)
115
- aws-sdk-s3 (1.114.0)
116
- aws-sdk-core (~> 3, >= 3.127.0)
112
+ aws-sdk-s3 (1.111.3)
113
+ aws-sdk-core (~> 3, >= 3.125.0)
117
114
  aws-sdk-kms (~> 1)
118
115
  aws-sigv4 (~> 1.4)
119
- aws-sigv4 (1.5.1)
116
+ aws-sigv4 (1.4.0)
120
117
  aws-eventstream (~> 1, >= 1.0.2)
121
- bcrypt (3.1.18)
118
+ bcrypt (3.1.16)
122
119
  better_html (2.0.1)
123
120
  actionview (>= 6.0)
124
121
  activesupport (>= 6.0)
@@ -134,7 +131,7 @@ GEM
134
131
  railties (>= 5.0)
135
132
  builder (3.2.4)
136
133
  bump (0.10.0)
137
- bundler-integrity (1.0.9)
134
+ bundler-integrity (1.0.7)
138
135
  byebug (11.1.3)
139
136
  capybara (3.36.0)
140
137
  addressable
@@ -153,7 +150,7 @@ GEM
153
150
  crack (0.4.5)
154
151
  rexml
155
152
  crass (1.0.6)
156
- cssbundling-rails (1.1.1)
153
+ cssbundling-rails (1.0.0)
157
154
  railties (>= 6.0.0)
158
155
  database_cleaner (2.0.1)
159
156
  database_cleaner-active_record (~> 2.0.0)
@@ -170,20 +167,20 @@ GEM
170
167
  diff-lcs (1.5.0)
171
168
  digest (3.1.0)
172
169
  docile (1.4.0)
173
- dotenv (2.8.1)
174
- dotenv-rails (2.8.1)
175
- dotenv (= 2.8.1)
170
+ dotenv (2.7.6)
171
+ dotenv-rails (2.7.6)
172
+ dotenv (= 2.7.6)
176
173
  railties (>= 3.2)
177
174
  dry-initializer (3.1.1)
178
175
  erb-formatter (0.3.0)
179
176
  erubi (1.11.0)
180
- factory_bot (6.2.1)
177
+ factory_bot (6.2.0)
181
178
  activesupport (>= 5.0.0)
182
179
  factory_bot_rails (6.2.0)
183
180
  factory_bot (~> 6.2.0)
184
181
  railties (>= 5.0.0)
185
- faker (2.22.0)
186
- i18n (>= 1.8.11, < 2)
182
+ faker (2.19.0)
183
+ i18n (>= 1.6, < 2)
187
184
  ffi (1.15.5)
188
185
  friendly_id (5.4.2)
189
186
  activerecord (>= 4.0.0)
@@ -193,16 +190,16 @@ GEM
193
190
  gem-release (2.2.2)
194
191
  globalid (1.0.0)
195
192
  activesupport (>= 5.0)
196
- groupdate (6.1.0)
197
- activesupport (>= 5.2)
193
+ groupdate (5.2.4)
194
+ activesupport (>= 5)
198
195
  hashdiff (1.0.1)
199
196
  highline (2.0.3)
200
197
  hightop (0.3.0)
201
198
  activesupport (>= 5.2)
202
- hotwire-livereload (1.2.2)
199
+ hotwire-livereload (1.1.0)
203
200
  listen (>= 3.0.0)
204
201
  rails (>= 6.0.0)
205
- htmlbeautifier (1.4.2)
202
+ htmlbeautifier (1.4.1)
206
203
  httparty (0.20.0)
207
204
  mime-types (~> 3.0)
208
205
  multi_xml (>= 0.5.2)
@@ -225,12 +222,12 @@ GEM
225
222
  inline_svg (1.8.0)
226
223
  activesupport (>= 3.0)
227
224
  nokogiri (>= 1.6)
225
+ io-wait (0.2.1)
228
226
  iso (0.4.0)
229
227
  i18n
230
228
  jmespath (1.6.1)
231
- jsbundling-rails (1.0.3)
229
+ jsbundling-rails (1.0.0)
232
230
  railties (>= 6.0.0)
233
- json (2.6.2)
234
231
  launchy (2.5.0)
235
232
  addressable (~> 2.7)
236
233
  listen (3.7.1)
@@ -246,7 +243,7 @@ GEM
246
243
  zeitwerk
247
244
  marcel (1.0.2)
248
245
  matrix (0.4.2)
249
- meta-tags (2.17.0)
246
+ meta-tags (2.16.0)
250
247
  actionpack (>= 3.2.0, < 7.1)
251
248
  method_source (1.0.0)
252
249
  mime-types (3.4.1)
@@ -256,9 +253,10 @@ GEM
256
253
  mini_mime (1.1.2)
257
254
  mini_portile2 (2.8.0)
258
255
  minitest (5.16.3)
259
- msgpack (1.5.6)
256
+ msgpack (1.6.0)
260
257
  multi_xml (0.6.0)
261
- net-protocol (0.1.3)
258
+ net-protocol (0.1.2)
259
+ io-wait
262
260
  timeout
263
261
  net-smtp (0.3.1)
264
262
  digest
@@ -268,15 +266,17 @@ GEM
268
266
  nokogiri (1.13.9)
269
267
  mini_portile2 (~> 2.8.0)
270
268
  racc (~> 1.4)
269
+ nokogiri (1.13.9-x86_64-linux)
270
+ racc (~> 1.4)
271
271
  orm_adapter (0.5.0)
272
272
  pagy (5.10.1)
273
273
  activesupport
274
- parallel (1.22.1)
275
- parser (3.1.2.1)
274
+ parallel (1.21.0)
275
+ parser (3.1.0.0)
276
276
  ast (~> 2.4.1)
277
- pg (1.4.3)
278
- public_suffix (5.0.0)
279
- puma (5.6.5)
277
+ pg (1.3.1)
278
+ public_suffix (4.0.6)
279
+ puma (5.6.4)
280
280
  nio4r (~> 2.0)
281
281
  pundit (2.2.0)
282
282
  activesupport (>= 3.0.0)
@@ -319,27 +319,27 @@ GEM
319
319
  thor (~> 1.0)
320
320
  rainbow (3.1.1)
321
321
  rake (13.0.6)
322
- ransack (3.2.1)
323
- activerecord (>= 6.1.5)
324
- activesupport (>= 6.1.5)
322
+ ransack (2.5.0)
323
+ activerecord (>= 5.2.4)
324
+ activesupport (>= 5.2.4)
325
325
  i18n
326
- rb-fsevent (0.11.1)
326
+ rb-fsevent (0.11.0)
327
327
  rb-inotify (0.10.1)
328
328
  ffi (~> 1.0)
329
- redis (4.8.0)
330
- regexp_parser (2.5.0)
329
+ redis (4.6.0)
330
+ regexp_parser (2.2.0)
331
331
  responders (3.0.1)
332
332
  actionpack (>= 5.0)
333
333
  railties (>= 5.0)
334
334
  rexml (3.2.5)
335
- rspec-core (3.11.0)
336
- rspec-support (~> 3.11.0)
337
- rspec-expectations (3.11.0)
335
+ rspec-core (3.10.2)
336
+ rspec-support (~> 3.10.0)
337
+ rspec-expectations (3.10.2)
338
338
  diff-lcs (>= 1.2.0, < 2.0)
339
- rspec-support (~> 3.11.0)
340
- rspec-mocks (3.11.1)
339
+ rspec-support (~> 3.10.0)
340
+ rspec-mocks (3.10.3)
341
341
  diff-lcs (>= 1.2.0, < 2.0)
342
- rspec-support (~> 3.11.0)
342
+ rspec-support (~> 3.10.0)
343
343
  rspec-rails (4.0.2)
344
344
  actionpack (>= 4.2)
345
345
  activesupport (>= 4.2)
@@ -348,35 +348,33 @@ GEM
348
348
  rspec-expectations (~> 3.10)
349
349
  rspec-mocks (~> 3.10)
350
350
  rspec-support (~> 3.10)
351
- rspec-support (3.11.0)
352
- rubocop (1.35.0)
353
- json (~> 2.3)
351
+ rspec-support (3.10.3)
352
+ rubocop (1.25.0)
354
353
  parallel (~> 1.10)
355
- parser (>= 3.1.2.1)
354
+ parser (>= 3.1.0.0)
356
355
  rainbow (>= 2.2.2, < 4.0)
357
356
  regexp_parser (>= 1.8, < 3.0)
358
- rexml (>= 3.2.5, < 4.0)
359
- rubocop-ast (>= 1.20.1, < 2.0)
357
+ rexml
358
+ rubocop-ast (>= 1.15.1, < 2.0)
360
359
  ruby-progressbar (~> 1.7)
361
360
  unicode-display_width (>= 1.4.0, < 3.0)
362
- rubocop-ast (1.21.0)
363
- parser (>= 3.1.1.0)
364
- rubocop-performance (1.14.3)
361
+ rubocop-ast (1.15.1)
362
+ parser (>= 3.0.1.1)
363
+ rubocop-performance (1.13.2)
365
364
  rubocop (>= 1.7.0, < 2.0)
366
365
  rubocop-ast (>= 0.4.0)
367
- rubocop-shopify (2.9.0)
368
- rubocop (~> 1.33)
366
+ rubocop-shopify (2.5.0)
367
+ rubocop (~> 1.25)
369
368
  ruby-debug-ide (0.7.3)
370
369
  rake (>= 0.8.1)
371
370
  ruby-progressbar (1.11.0)
372
371
  ruby-vips (2.1.4)
373
372
  ffi (~> 1.12)
374
373
  rubyzip (2.3.2)
375
- selenium-webdriver (4.5.0)
374
+ selenium-webdriver (4.1.0)
376
375
  childprocess (>= 0.5, < 5.0)
377
376
  rexml (~> 3.2, >= 3.2.5)
378
- rubyzip (>= 1.2.2, < 3.0)
379
- websocket (~> 1.0)
377
+ rubyzip (>= 1.2.2)
380
378
  simplecov (0.21.2)
381
379
  docile (~> 1.1)
382
380
  simplecov-html (~> 0.11)
@@ -385,7 +383,7 @@ GEM
385
383
  rexml
386
384
  simplecov (~> 0.19)
387
385
  simplecov-html (0.12.3)
388
- simplecov_json_formatter (0.1.4)
386
+ simplecov_json_formatter (0.1.3)
389
387
  sixarm_ruby_unaccent (1.2.0)
390
388
  smart_properties (1.17.0)
391
389
  spring (4.0.0)
@@ -398,21 +396,21 @@ GEM
398
396
  actionpack (>= 5.2)
399
397
  activesupport (>= 5.2)
400
398
  sprockets (>= 3.0.0)
401
- standard (1.16.0)
402
- rubocop (= 1.35.0)
403
- rubocop-performance (= 1.14.3)
399
+ standard (1.7.0)
400
+ rubocop (= 1.25.0)
401
+ rubocop-performance (= 1.13.2)
404
402
  terminal-table (3.0.2)
405
403
  unicode-display_width (>= 1.1.1, < 3)
406
- test-prof (1.0.10)
404
+ test-prof (1.0.7)
407
405
  thor (1.2.1)
408
- timeout (0.3.0)
409
- turbo-rails (1.3.0)
406
+ timeout (0.2.0)
407
+ turbo-rails (1.3.2)
410
408
  actionpack (>= 6.0.0)
411
409
  activejob (>= 6.0.0)
412
410
  railties (>= 6.0.0)
413
411
  tzinfo (2.0.5)
414
412
  concurrent-ruby (~> 1.0)
415
- unicode-display_width (2.2.0)
413
+ unicode-display_width (2.1.0)
416
414
  view_component (2.74.1)
417
415
  activesupport (>= 5.0.0, < 8.0)
418
416
  concurrent-ruby (~> 1.0)
@@ -424,21 +422,20 @@ GEM
424
422
  activemodel (>= 6.0.0)
425
423
  bindex (>= 0.4.0)
426
424
  railties (>= 6.0.0)
427
- webdrivers (5.2.0)
425
+ webdrivers (5.0.0)
428
426
  nokogiri (~> 1.6)
429
427
  rubyzip (>= 1.3.0)
430
428
  selenium-webdriver (~> 4.0)
431
- webmock (3.18.1)
429
+ webmock (3.14.0)
432
430
  addressable (>= 2.8.0)
433
431
  crack (>= 0.3.2)
434
432
  hashdiff (>= 0.4.0, < 2.0.0)
435
- websocket (1.2.9)
436
433
  websocket-driver (0.7.5)
437
434
  websocket-extensions (>= 0.1.0)
438
435
  websocket-extensions (0.1.5)
439
436
  xpath (3.2.0)
440
437
  nokogiri (~> 1.8)
441
- zeitwerk (2.6.1)
438
+ zeitwerk (2.6.0)
442
439
 
443
440
  PLATFORMS
444
441
  ruby
@@ -447,6 +444,7 @@ PLATFORMS
447
444
  DEPENDENCIES
448
445
  active_link_to
449
446
  active_median
447
+ activestorage
450
448
  acts-as-taggable-on (~> 9.0)
451
449
  acts_as_list
452
450
  addressable
@@ -462,6 +460,7 @@ DEPENDENCIES
462
460
  bundler-integrity (~> 1.0)
463
461
  byebug
464
462
  capybara (= 3.36)
463
+ chartkick
465
464
  countries
466
465
  cssbundling-rails
467
466
  database_cleaner
@@ -490,7 +489,6 @@ DEPENDENCIES
490
489
  pg (>= 0.18, < 2.0)
491
490
  puma (~> 5.6.4)
492
491
  pundit
493
- rails (~> 6.1.0)
494
492
  rails-controller-testing
495
493
  ransack
496
494
  redis (~> 4.0)
@@ -503,6 +501,7 @@ DEPENDENCIES
503
501
  simplecov-cobertura
504
502
  spring
505
503
  spring-commands-rspec
504
+ sprockets-rails
506
505
  standard
507
506
  test-prof
508
507
  tzinfo-data
@@ -512,4 +511,4 @@ DEPENDENCIES
512
511
  zeitwerk (~> 2.3)
513
512
 
514
513
  BUNDLED WITH
515
- 2.3.5
514
+ 2.3.23
@@ -2,18 +2,16 @@
2
2
  class: classes,
3
3
  style: style,
4
4
  data: data do %>
5
- <div class="h-full <% if stacked? %> md:pt-4 <% else %> md:pt-0 md:h-14 <% end %> pt-4 flex self-start items-center text-slate-800">
6
- <div class="w-48 <% if compact? %> md:w-48 xl:w-64 <% else %> md:w-64 <% end %> px-6 flex uppercase font-semibold text-gray-500 text-sm" data-slot="label">
7
- <% if form.present? %>
8
- <%= form.label field.id, label %>
9
- <% else %>
10
- <%= field.name %>
11
- <% end %>
12
- <% if on_edit? && field.is_required? %> <span class="text-red-600 ml-1">*</span> <% end %>
13
- </div>
5
+ <div class="h-full <% if stacked? %> md:pt-4 <% else %> md:pt-0 md:h-14 <% end %> pt-4 flex self-start items-center <%= @field.get_html(:classes, view: view, element: :label) %> w-48 <% if compact? %> md:w-48 xl:w-64 <% else %> md:w-64 <% end %> px-6 uppercase font-semibold text-gray-500 text-sm" data-slot="label">
6
+ <% if form.present? %>
7
+ <%= form.label field.id, label %>
8
+ <% else %>
9
+ <%= field.name %>
10
+ <% end %>
11
+ <% if on_edit? && field.is_required? %> <span class="text-red-600 ml-1">*</span> <% end %>
14
12
  </div>
15
- <div class="flex-1 flex flex-row md:min-h-inherit py-2 <% if stacked? %> pb-4 <% else %><% end %> px-6">
16
- <div class="self-center <% if full_width? || compact? || stacked? %> w-full <% else %> md:w-8/12 <% end %>" data-slot="value">
13
+ <div class="flex-1 flex flex-row md:min-h-inherit py-2 <% if stacked? %> pb-4 <% else %><% end %> px-6 <%= @field.get_html(:classes, view: view, element: :content) %>" data-slot="value">
14
+ <div class="self-center <% if full_width? || compact? || stacked? %> w-full <% else %> md:w-8/12 <% end %>">
17
15
  <% if on_show? %>
18
16
  <% if field.value.blank? and dash_if_blank %>
19
17
 
@@ -19,7 +19,7 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
19
19
  full_width: false,
20
20
  label: nil, # do we really need it?
21
21
  resource: nil,
22
- stacked: false,
22
+ stacked: nil,
23
23
  style: "",
24
24
  view: :show,
25
25
  **args
@@ -41,7 +41,7 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
41
41
  end
42
42
 
43
43
  def classes(extra_classes = "")
44
- "relative flex flex-col flex-grow pb-2 md:pb-0 leading-tight min-h-14 #{stacked? ? "" : "md:flex-row md:items-center"} #{@classes || ""} #{extra_classes || ""} #{@field.get_html(:classes, view: view, element: :wrapper)}"
44
+ "field-wrapper relative flex flex-col flex-grow pb-2 md:pb-0 leading-tight min-h-14 #{stacked? ? "field-wrapper-layout-stacked" : "field-wrapper-layout-inline md:flex-row md:items-center"} #{compact? ? "field-wrapper-size-compact" : "field-wrapper-size-regular"} #{full_width? ? "field-width-full" : "field-width-regular"} #{@classes || ""} #{extra_classes || ""} #{@field.get_html(:classes, view: view, element: :wrapper)}"
45
45
  end
46
46
 
47
47
  def style
@@ -91,7 +91,14 @@ class Avo::FieldWrapperComponent < ViewComponent::Base
91
91
  end
92
92
 
93
93
  def stacked?
94
- @stacked
94
+ # Override on the declaration level
95
+ return @stacked unless @stacked.nil?
96
+
97
+ # Fetch it from the field
98
+ return field.stacked unless field.stacked.nil?
99
+
100
+ # Fallback to defaults
101
+ Avo.configuration.field_wrapper_layout == :stacked
95
102
  end
96
103
 
97
104
  def compact?
@@ -10,11 +10,11 @@
10
10
  date_field_field_type_value: "date",
11
11
  date_field_picker_options_value: @field.picker_options,
12
12
  } do %>
13
- <%= datetime_field "fake_#{@field.id}", "fake",
13
+ <%= @form.text_field @field.id,
14
14
  value: @field.edit_formatted_value,
15
- class: classes("w-full"),
15
+ class: classes("w-full #{"hidden" unless params[:avo_show_hidden_inputs]}"),
16
16
  data: {
17
- 'date-field-target': 'fakeInput',
17
+ 'date-field-target': 'input',
18
18
  placeholder: @field.placeholder,
19
19
  **@field.get_html(:data, view: view, element: :input)
20
20
  },
@@ -22,11 +22,11 @@
22
22
  placeholder: @field.placeholder,
23
23
  style: @field.get_html(:style, view: view, element: :input)
24
24
  %>
25
- <%= @form.text_field @field.id,
25
+ <%= datetime_field "fake_#{@field.id}", "fake",
26
26
  value: @field.edit_formatted_value,
27
- class: classes("w-full hidden"),
27
+ class: classes("w-full"),
28
28
  data: {
29
- 'date-field-target': 'input',
29
+ 'date-field-target': 'fakeInput',
30
30
  placeholder: @field.placeholder,
31
31
  **@field.get_html(:data, view: view, element: :input)
32
32
  },
@@ -12,11 +12,11 @@
12
12
  date_field_field_type_value: "dateTime",
13
13
  date_field_picker_options_value: @field.picker_options,
14
14
  } do %>
15
- <%= datetime_field "fake_#{@field.id}", "fake",
15
+ <%= @form.text_field @field.id,
16
16
  value: @field.edit_formatted_value,
17
- class: classes("w-full"),
17
+ class: classes("w-full #{"hidden" unless params[:avo_show_hidden_inputs]}"),
18
18
  data: {
19
- 'date-field-target': 'fakeInput',
19
+ 'date-field-target': 'input',
20
20
  placeholder: @field.placeholder,
21
21
  **@field.get_html(:data, view: view, element: :input)
22
22
  },
@@ -24,11 +24,11 @@
24
24
  placeholder: @field.placeholder,
25
25
  style: @field.get_html(:style, view: view, element: :input)
26
26
  %>
27
- <%= @form.text_field @field.id,
27
+ <%= datetime_field "fake_#{@field.id}", "fake",
28
28
  value: @field.edit_formatted_value,
29
- class: classes("w-full hidden"),
29
+ class: classes("w-full"),
30
30
  data: {
31
- 'date-field-target': 'input',
31
+ 'date-field-target': 'fakeInput',
32
32
  placeholder: @field.placeholder,
33
33
  **@field.get_html(:data, view: view, element: :input)
34
34
  },
@@ -12,7 +12,7 @@ class Avo::Fields::EditComponent < ViewComponent::Base
12
12
  attr_reader :stacked
13
13
  attr_reader :view
14
14
 
15
- def initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: false, multiple: false, **kwargs)
15
+ def initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: nil, multiple: false, **kwargs)
16
16
  @compact = compact
17
17
  @field = field
18
18
  @form = form
@@ -10,7 +10,7 @@ class Avo::Fields::ShowComponent < ViewComponent::Base
10
10
  attr_reader :stacked
11
11
  attr_reader :view
12
12
 
13
- def initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: false)
13
+ def initialize(field: nil, resource: nil, index: 0, form: nil, compact: false, stacked: nil)
14
14
  @compact = compact
15
15
  @field = field
16
16
  @index = index
@@ -12,11 +12,11 @@
12
12
  date_field_field_type_value: "time",
13
13
  date_field_picker_options_value: @field.picker_options,
14
14
  } do %>
15
- <%= datetime_field "fake_#{@field.id}", "fake",
15
+ <%= @form.text_field @field.id,
16
16
  value: @field.edit_formatted_value,
17
- class: classes("w-full"),
17
+ class: classes("w-full #{"hidden" unless params[:avo_show_hidden_inputs]}"),
18
18
  data: {
19
- 'date-field-target': 'fakeInput',
19
+ 'date-field-target': 'input',
20
20
  placeholder: @field.placeholder,
21
21
  **@field.get_html(:data, view: view, element: :input)
22
22
  },
@@ -24,11 +24,11 @@
24
24
  placeholder: @field.placeholder,
25
25
  style: @field.get_html(:style, view: view, element: :input)
26
26
  %>
27
- <%= @form.text_field @field.id,
27
+ <%= datetime_field "fake_#{@field.id}", "fake",
28
28
  value: @field.edit_formatted_value,
29
- class: classes("w-full hidden"),
29
+ class: classes("w-full"),
30
30
  data: {
31
- 'date-field-target': 'input',
31
+ 'date-field-target': 'fakeInput',
32
32
  placeholder: @field.placeholder,
33
33
  **@field.get_html(:data, view: view, element: :input)
34
34
  },
@@ -1,4 +1,4 @@
1
- <div class="w-full relative"
1
+ <div class="w-full relative overflow-auto mac-styled-scrollbar"
2
2
  data-controller="item-select-all"
3
3
  data-resource-name="<%= @resource.model_key %>"
4
4
  data-item-select-all-selected-all-value="false"
@@ -7,7 +7,10 @@
7
7
  <% c.body do %>
8
8
  <div class="divide-y">
9
9
  <% item.items.each_with_index do |field, index| %>
10
- <%= render field.hydrate(resource: @resource, model: @resource.model, user: resource.user, view: view).component_for_view(view).new(field: field, resource: @resource, index: index, form: form) %>
10
+ <%= render field
11
+ .hydrate(resource: @resource, model: @resource.model, user: resource.user, view: view)
12
+ .component_for_view(view)
13
+ .new(field: field, resource: @resource, index: index, form: form) %>
11
14
  <% end %>
12
15
  </div>
13
16
  <% end %>
@@ -25,8 +25,11 @@
25
25
  <% end %>
26
26
  <% if body? %>
27
27
  <div class="flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:gap-4 w-full">
28
- <div class="relative flex-1 <%= white_panel_classes %> <%= @body_classes %> <% if sidebar? %> w-2/3 overflow-auto <% else %> w-full <% end %>">
29
- <%= body %>
28
+ <div class="relative flex-1 <% if sidebar? %> w-2/3 <% else %> w-full <% end %>">
29
+ <% # The body is wrapped inside another div in order to avoid long & tall panels next to sidebars when the sidebar taller. %>
30
+ <div class="relative <%= white_panel_classes %> <%= @body_classes %>">
31
+ <%= body %>
32
+ </div>
30
33
  </div>
31
34
  <% if sidebar? %>
32
35
  <div class="w-full sm:w-1/3 flex-shrink-0 h-full <%= white_panel_classes %>">
@@ -1,6 +1,8 @@
1
1
  <%= content_tag :div,
2
2
  data: {
3
- 'model-id': @resource.model.id,
3
+ model_name: @resource.model_name.to_s,
4
+ resource_name: @resource.class.to_s,
5
+ model_id: @resource.model.id,
4
6
  selected_resources_name: @resource.model_key,
5
7
  selected_resources: [@resource.model.id],
6
8
  **@resource.stimulus_data_attributes