Improve clean-up of dropped files [SCI-1747]

This commit is contained in:
Oleksii Kriuchykhin 2017-11-28 16:48:47 +01:00
parent e35031dd9a
commit 745dac09a7
2 changed files with 10 additions and 4 deletions

View file

@ -123,6 +123,7 @@
initPreviewModal();
SmartAnnotation.preventPropagation('.atwho-user-popover');
TinyMCE.destroyAll();
DragNDropSteps.clearFiles();
}, 1000);
})
@ -148,8 +149,8 @@
initializeCheckboxSorting();
animateSpinner(null, false);
initPreviewModal();
TinyMCE.refresh()
DragNDropSteps.clearFiles();
TinyMCE.refresh();
$("#new-step-checklists fieldset.nested_step_checklists ul").each(function () {
enableCheckboxSorting(this);
});
@ -371,6 +372,7 @@
newStepHandler();
});
toggleButtons(true);
DragNDropSteps.clearFiles();
});
}

View file

@ -19,6 +19,10 @@
return filesValid;
}
function clearFiles() {
droppedFiles = [];
}
// loops through a list of files and display each file in a separate panel
function listItems() {
totalSize = 0;
@ -49,7 +53,6 @@
var name = 'step[assets_attributes][' + index + '][file]';
fd.append(name, droppedFiles[i]);
}
droppedFiles = [];
filesValid = true;
totalSize = 0;
_dragNdropAssetsOff();
@ -144,7 +147,8 @@
init: init,
appendFilesToForm: appendFilesToForm,
listItems: listItems,
filesStatus: filesStatus
filesStatus: filesStatus,
clearFiles: clearFiles
});
})();