avo 1.18.0.pre.1 → 1.18.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 (36) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile.lock +2 -2
  3. data/app/components/avo/fields/files_field/edit_component.html.erb +3 -1
  4. data/app/packs/entrypoints/application.css +1 -0
  5. data/app/packs/entrypoints/application.js +1 -0
  6. data/app/packs/js/active-storage.js +45 -0
  7. data/app/packs/stylesheets/active-storage.css +37 -0
  8. data/lib/avo/engine.rb +5 -0
  9. data/lib/avo/fields/files_field.rb +0 -2
  10. data/lib/avo/version.rb +1 -1
  11. data/public/avo-packs/css/{application-2b4685ca.css → application-f9191617.css} +39 -1
  12. data/public/avo-packs/css/application-f9191617.css.br +0 -0
  13. data/public/avo-packs/css/application-f9191617.css.gz +0 -0
  14. data/public/avo-packs/css/application-f9191617.css.map +1 -0
  15. data/public/avo-packs/css/application-f9191617.css.map.br +0 -0
  16. data/public/avo-packs/css/application-f9191617.css.map.gz +0 -0
  17. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js +26 -0
  18. data/public/avo-packs/js/{application-6842378de4da9b615e18.js.LICENSE.txt → application-cc89f096028eb1d4d971.js.LICENSE.txt} +0 -0
  19. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.br +0 -0
  20. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.gz +0 -0
  21. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map +1 -0
  22. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.br +0 -0
  23. data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.gz +0 -0
  24. data/public/avo-packs/manifest.json +15 -15
  25. metadata +19 -17
  26. data/public/avo-packs/css/application-2b4685ca.css.br +0 -0
  27. data/public/avo-packs/css/application-2b4685ca.css.gz +0 -0
  28. data/public/avo-packs/css/application-2b4685ca.css.map +0 -1
  29. data/public/avo-packs/css/application-2b4685ca.css.map.br +0 -0
  30. data/public/avo-packs/css/application-2b4685ca.css.map.gz +0 -0
  31. data/public/avo-packs/js/application-6842378de4da9b615e18.js +0 -26
  32. data/public/avo-packs/js/application-6842378de4da9b615e18.js.br +0 -0
  33. data/public/avo-packs/js/application-6842378de4da9b615e18.js.gz +0 -0
  34. data/public/avo-packs/js/application-6842378de4da9b615e18.js.map +0 -1
  35. data/public/avo-packs/js/application-6842378de4da9b615e18.js.map.br +0 -0
  36. data/public/avo-packs/js/application-6842378de4da9b615e18.js.map.gz +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ccd552281f8ac8b77ea15f6d9000271a447a01190cb3c46905898f94df366009
4
- data.tar.gz: c97173ac80821f5ef2de0f3d1060be50fe1c3b2c19d1b2f8eb177c9fc750f2d2
3
+ metadata.gz: 46ae39b5c77496f7ebfc4da3404f2d7a5a906cb4098fa174b2b1b37c7ad07dde
4
+ data.tar.gz: 1769e6b5c3b2db3d45cc40985a1fb098b7fc8514c42be1317769312571c0c302
5
5
  SHA512:
6
- metadata.gz: 84703917f0960fb186bd79b5b7463298afd544e625f0b9ef83af6373c56d673e22479c2e88528cd2df1add04bd2ced0c31d50ea4bc6d856cfb26dd00a07cac42
7
- data.tar.gz: f0e6a6d3b59bf79dac877bb012da1f56c979bf72897241e0f9d1633c7745e7fc1ce769d72610105d42b1e37d4a86f19e8a1e39370e709a2be24869a4b7a20981
6
+ metadata.gz: 61a8c1c00aba9bd9673be393add7b9d6b18efca2006ca2527299231fe152e5e0cdf0f2ee1f7f2f889afb5dc9726a29963b13d2b5be451387d96e30dc8f0d06e0
7
+ data.tar.gz: e195465f471e4c9cd37bb5e2db31711ee1f9101f7dd5095da752acb6f4a76a818bccac7552434c545f108726c96139fb45f15113b57c3649e7807292f6fe6586
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- avo (1.18.0.pre.1)
4
+ avo (1.18.1)
5
5
  active_link_to
6
6
  addressable
7
7
  breadcrumbs_on_rails
@@ -210,7 +210,7 @@ GEM
210
210
  mini_portile2 (~> 2.6.1)
211
211
  racc (~> 1.4)
212
212
  orm_adapter (0.5.0)
213
- pagy (5.6.6)
213
+ pagy (5.6.10)
214
214
  parallel (1.20.1)
215
215
  parser (3.0.0.0)
216
216
  ast (~> 2.4.1)
@@ -2,6 +2,8 @@
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, direct_upload: @field.direct_upload %>
5
+ <div class="mt-2">
6
+ <%= @form.file_field @field.id, disabled: @field.readonly, multiple: true, direct_upload: @field.direct_upload %>
7
+ </div>
6
8
  <% end %>
7
9
  <% end %>
@@ -16,6 +16,7 @@
16
16
  @import './../stylesheets/pagination.css';
17
17
  @import './../stylesheets/breadcrumbs.css';
18
18
  @import './../stylesheets/search.css';
19
+ @import './../stylesheets/active-storage.css';
19
20
 
20
21
  @import './../stylesheets/components/status.css';
21
22
  @import './../stylesheets/components/code.css';
@@ -11,6 +11,7 @@ import Rails from '@rails/ujs'
11
11
  import tippy from 'tippy.js'
12
12
 
13
13
  // Toastr alerts
14
+ import '../js/active-storage'
14
15
  import '../js/toastr'
15
16
 
16
17
  Rails.start()
@@ -0,0 +1,45 @@
1
+ document.addEventListener('direct-upload:initialize', (event) => {
2
+ const { target, detail } = event
3
+ const { id, file } = detail
4
+
5
+ target.insertAdjacentHTML(
6
+ 'beforebegin',
7
+ `
8
+ <div id="direct-upload-${id}" class="direct-upload direct-upload--pending">
9
+ <div id="direct-upload-progress-${id}" class="direct-upload__progress" style="width: 0%"></div>
10
+ <span class="direct-upload__filename"></span>
11
+ </div>
12
+ `,
13
+ )
14
+ target.previousElementSibling.querySelector(
15
+ '.direct-upload__filename',
16
+ ).textContent = file.name
17
+ })
18
+
19
+ document.addEventListener('direct-upload:start', (event) => {
20
+ const { id } = event.detail
21
+ const element = document.getElementById(`direct-upload-${id}`)
22
+ element.classList.remove('direct-upload--pending')
23
+ })
24
+
25
+ document.addEventListener('direct-upload:progress', (event) => {
26
+ const { id, progress } = event.detail
27
+ const progressElement = document.getElementById(
28
+ `direct-upload-progress-${id}`,
29
+ )
30
+ progressElement.style.width = `${progress}%`
31
+ })
32
+
33
+ document.addEventListener('direct-upload:error', (event) => {
34
+ event.preventDefault()
35
+ const { id, error } = event.detail
36
+ const element = document.getElementById(`direct-upload-${id}`)
37
+ element.classList.add('direct-upload--error')
38
+ element.setAttribute('title', error)
39
+ })
40
+
41
+ document.addEventListener('direct-upload:end', (event) => {
42
+ const { id } = event.detail
43
+ const element = document.getElementById(`direct-upload-${id}`)
44
+ element.classList.add('direct-upload--complete')
45
+ })
@@ -0,0 +1,37 @@
1
+ .direct-upload {
2
+ display: inline-block;
3
+ position: relative;
4
+ padding: 2px 4px;
5
+ margin: 0 3px 3px 0;
6
+ border: 1px solid rgba(0, 0, 0, 0.3);
7
+ border-radius: 3px;
8
+ font-size: 11px;
9
+ line-height: 13px;
10
+ }
11
+
12
+ .direct-upload--pending {
13
+ opacity: 0.6;
14
+ }
15
+
16
+ .direct-upload__progress {
17
+ position: absolute;
18
+ top: 0;
19
+ left: 0;
20
+ bottom: 0;
21
+ opacity: 0.2;
22
+ background: #0076ff;
23
+ transition: width 120ms ease-out, opacity 60ms 60ms ease-in;
24
+ transform: translate3d(0, 0, 0);
25
+ }
26
+
27
+ .direct-upload--complete .direct-upload__progress {
28
+ opacity: 0.4;
29
+ }
30
+
31
+ .direct-upload--error {
32
+ border-color: red;
33
+ }
34
+
35
+ input[type=file][data-direct-upload-url][disabled] {
36
+ display: none;
37
+ }
data/lib/avo/engine.rb CHANGED
@@ -3,6 +3,11 @@ Gem.loaded_specs["avo"].dependencies.each do |d|
3
3
  require d.name
4
4
  end
5
5
 
6
+ # In development we should load the engine so we get the autoload for components
7
+ if ENV["RAILS_ENV"] === "development"
8
+ require "view_component/engine"
9
+ end
10
+
6
11
  module Avo
7
12
  class Engine < ::Rails::Engine
8
13
  isolate_namespace Avo
@@ -25,8 +25,6 @@ module Avo
25
25
  value.each do |file|
26
26
  # Skip empty values
27
27
  next unless file.present?
28
- # Skip Capybara Nil files in tests
29
- next unless file.class === Capybara::RackTest::Form::NilUploadedFile
30
28
 
31
29
  model.send(key).attach file
32
30
  end
data/lib/avo/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Avo
2
- VERSION = "1.18.0.pre.1"
2
+ VERSION = "1.18.1"
3
3
  end
@@ -3220,6 +3220,44 @@ svg.tea #steamR {
3220
3220
  color: rgba(255, 255, 255, var(--tw-text-opacity));
3221
3221
  }
3222
3222
 
3223
+ .direct-upload {
3224
+ display: inline-block;
3225
+ position: relative;
3226
+ padding: 2px 4px;
3227
+ margin: 0 3px 3px 0;
3228
+ border: 1px solid rgba(0, 0, 0, 0.3);
3229
+ border-radius: 3px;
3230
+ font-size: 11px;
3231
+ line-height: 13px;
3232
+ }
3233
+
3234
+ .direct-upload--pending {
3235
+ opacity: 0.6;
3236
+ }
3237
+
3238
+ .direct-upload__progress {
3239
+ position: absolute;
3240
+ top: 0;
3241
+ left: 0;
3242
+ bottom: 0;
3243
+ opacity: 0.2;
3244
+ background: #0076ff;
3245
+ transition: width 120ms ease-out, opacity 60ms 60ms ease-in;
3246
+ transform: translate3d(0, 0, 0);
3247
+ }
3248
+
3249
+ .direct-upload--complete .direct-upload__progress {
3250
+ opacity: 0.4;
3251
+ }
3252
+
3253
+ .direct-upload--error {
3254
+ border-color: red;
3255
+ }
3256
+
3257
+ input[type=file][data-direct-upload-url][disabled] {
3258
+ display: none;
3259
+ }
3260
+
3223
3261
  .spinner {
3224
3262
  width: 16px;
3225
3263
  height: 16px;
@@ -6246,4 +6284,4 @@ html, body{
6246
6284
  }
6247
6285
 
6248
6286
 
6249
- /*# sourceMappingURL=application-2b4685ca.css.map*/
6287
+ /*# sourceMappingURL=application-f9191617.css.map*/