Removing rejected files immediately and alerting about it

This commit is contained in:
Djamil Legato
2014-09-22 22:21:59 -07:00
parent 7186082e65
commit 710bd46a58

View File

@@ -37,13 +37,24 @@
thisDropzone = this;
$.get(URI + '/task:listmedia', function(data) {
$.each(data, function(filename, data){
var mockFile = { name: filename, size: data.size, extras: data };
var mockFile = { name: filename, size: data.size, accepted: true, extras: data };
thisDropzone.files.push(mockFile);
thisDropzone.options.addedfile.call(thisDropzone, mockFile);
thisDropzone.options.thumbnail.call(thisDropzone, mockFile, data.url);
});
});
this.on("complete", function(file) {
if (file.accepted) return;
var data = {status: 'error', message: 'Unsupported file type: ' + file.name.match(/\..+/).join('')};
$.proxy(modalError, this, {
file: file,
data: data,
mode: 'removeFile',
msg: '<p>An error occurred while trying to add the file <strong>'+file.name+'</strong></p><pre>'+data.message+'</pre>'
})();
});
this.on('success', function(file, response){
thisDropzone = this;
$.proxy(modalError, this, {
@@ -55,6 +66,7 @@
});
this.on('removedfile', function(file) {
if (!file.accepted) return;
thisDropzone = this;
$.post(URI + '/task:delmedia', {filename: file.name}, function(data){
$.proxy(modalError, thisDropzone, {