This commit is contained in:
Thomas Zilio 2020-06-30 13:25:21 +02:00
parent 5ab5ac2bf6
commit e71d4dcce2
1 changed files with 35 additions and 39 deletions

View File

@ -214,9 +214,10 @@ class FileManager implements ManagerInterface
Dropzone.autoDiscover = false; Dropzone.autoDiscover = false;
$(document).ready(function() { $(document).ready(function() {
var dragdrop = new Dropzone("#'.$attachment_id.' .dropzone", {
var dropzoneOptions = { dictDefaultMessage: "'.tr('Clicca o trascina qui per caricare uno o più file').'.<br>('.tr('Max upload: _SIZE_', [
dictDefaultMessage: "'.tr('Clicca o trascina qui per caricare uno o più file.<br>(Max ulpload: '.$upload_max_filesize.' MB)').'", '_SIZE_' => $upload_max_filesize.' MB'
]).')",
paramName: "file", paramName: "file",
maxFilesize: '.$upload_max_filesize.', // MB maxFilesize: '.$upload_max_filesize.', // MB
uploadMultiple: false, uploadMultiple: false,
@ -229,25 +230,20 @@ $(document).ready(function() {
this.on("sending", function(file, xhr, formData) { this.on("sending", function(file, xhr, formData) {
formData.append("categoria", $("#categoria").val()); formData.append("categoria", $("#categoria").val());
formData.append("nome_allegato", $("#nome_allegato").val()); formData.append("nome_allegato", $("#nome_allegato").val());
}), });
this.on("success", function (file) {
//console.log("success > " + file.name);
dragdrop.removeFile(file);
}),
this.on("complete", function (file) {
//Ricarico solo quando ho finito this.on("success", function (file) {
dragdrop.removeFile(file);
});
this.on("complete", function (file) {
// Ricarico solo quando ho finito
if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) { if (this.getUploadingFiles().length === 0 && this.getQueuedFiles().length === 0) {
reload_'.$attachment_id.'(); reload_'.$attachment_id.'();
} }
}); });
} }
}; });
var dragdrop = new Dropzone("div#dragdrop", dropzoneOptions);
// Modifica categoria // Modifica categoria
$("#'.$attachment_id.' .category-edit").click(function() { $("#'.$attachment_id.' .category-edit").click(function() {