mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-07 07:36:12 +02:00
Removing rejected files immediately and alerting about it
This commit is contained in:
@@ -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, {
|
||||
|
||||
Reference in New Issue
Block a user