avo 1.18.0.pre.1 → 1.18.0.pre.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.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/Gemfile.lock +4 -2
- data/app/components/avo/fields/files_field/edit_component.html.erb +3 -1
- data/app/controllers/avo/attachments_controller.rb +1 -2
- data/app/packs/entrypoints/application.css +1 -0
- data/app/packs/entrypoints/application.js +1 -0
- data/app/packs/js/active-storage.js +45 -0
- data/app/packs/stylesheets/active-storage.css +37 -0
- data/lib/avo/fields/files_field.rb +2 -2
- data/lib/avo/version.rb +1 -1
- data/public/avo-packs/css/{application-2b4685ca.css → application-f9191617.css} +39 -1
- data/public/avo-packs/css/application-f9191617.css.br +0 -0
- data/public/avo-packs/css/application-f9191617.css.gz +0 -0
- data/public/avo-packs/css/application-f9191617.css.map +1 -0
- data/public/avo-packs/css/application-f9191617.css.map.br +0 -0
- data/public/avo-packs/css/application-f9191617.css.map.gz +0 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js +26 -0
- data/public/avo-packs/js/{application-6842378de4da9b615e18.js.LICENSE.txt → application-cc89f096028eb1d4d971.js.LICENSE.txt} +0 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.br +0 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.gz +0 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map +1 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.br +0 -0
- data/public/avo-packs/js/application-cc89f096028eb1d4d971.js.map.gz +0 -0
- data/public/avo-packs/manifest.json +15 -15
- metadata +17 -15
- data/public/avo-packs/css/application-2b4685ca.css.br +0 -0
- data/public/avo-packs/css/application-2b4685ca.css.gz +0 -0
- data/public/avo-packs/css/application-2b4685ca.css.map +0 -1
- data/public/avo-packs/css/application-2b4685ca.css.map.br +0 -0
- data/public/avo-packs/css/application-2b4685ca.css.map.gz +0 -0
- data/public/avo-packs/js/application-6842378de4da9b615e18.js +0 -26
- data/public/avo-packs/js/application-6842378de4da9b615e18.js.br +0 -0
- data/public/avo-packs/js/application-6842378de4da9b615e18.js.gz +0 -0
- data/public/avo-packs/js/application-6842378de4da9b615e18.js.map +0 -1
- data/public/avo-packs/js/application-6842378de4da9b615e18.js.map.br +0 -0
- 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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca20ddd1db1b6f1d54f2aed3133447353a1bbba60ea7eda4b55487bbcc8f1239
|
4
|
+
data.tar.gz: 9631043fb317c49d93c76080172ebefeb278ca7749b8860eafe64f8fffe2c26f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3998c7fb60112685ab0d92754604f29b6a57bee36b235d2a9674a870ab83013f5e411419b8a14c4325b1b96386b807a7474561344cb0877c4045825af929d86a
|
7
|
+
data.tar.gz: 29e905bc525f5593910920eb574dc79e16d68fca01ff88ebe315fb6fe17b532e6c4cbafa7cd2ca20305e0db5e8d33b9349cd176f3d687bf828bc3285822ad0aa
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avo (1.18.0.pre.
|
4
|
+
avo (1.18.0.pre.2)
|
5
5
|
active_link_to
|
6
6
|
addressable
|
7
7
|
breadcrumbs_on_rails
|
@@ -209,8 +209,10 @@ 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)
|
212
214
|
orm_adapter (0.5.0)
|
213
|
-
pagy (5.6.
|
215
|
+
pagy (5.6.10)
|
214
216
|
parallel (1.20.1)
|
215
217
|
parser (3.0.0.0)
|
216
218
|
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
|
-
|
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 %>
|
@@ -21,8 +21,7 @@ module Avo
|
|
21
21
|
end
|
22
22
|
|
23
23
|
def destroy
|
24
|
-
|
25
|
-
attachment = blob.attachments.find_by record_id: params[:id], record_type: @model.class.to_s
|
24
|
+
attachment = ActiveStorage::Attachment.find(params[:signed_attachment_id])
|
26
25
|
|
27
26
|
if attachment.present?
|
28
27
|
attachment.destroy
|
@@ -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';
|
@@ -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
|
+
}
|
@@ -25,8 +25,8 @@ module Avo
|
|
25
25
|
value.each do |file|
|
26
26
|
# Skip empty values
|
27
27
|
next unless file.present?
|
28
|
-
#
|
29
|
-
next unless file.class ===
|
28
|
+
# Keep only String values
|
29
|
+
next unless file.class === String
|
30
30
|
|
31
31
|
model.send(key).attach file
|
32
32
|
end
|
data/lib/avo/version.rb
CHANGED
@@ -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-
|
6287
|
+
/*# sourceMappingURL=application-f9191617.css.map*/
|
Binary file
|
Binary file
|