Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
.split(",")
.map(function(t) {
return t.trim();
}).filter(function(t) {
return t.length > 0;
})
.join(",");
} catch(exp) {
tags = form.find('#tags');
}
data.append('tags', tags);
// attach images to the data
// var files = form.find('#image-mobile')[0].files;
var files = myDropzone.getFilesWithStatus(Dropzone.ADDED);
for(var i = 0; i < files.length; i++) {
var file = files[i];
data.append('image-mobile['+i+']', file);
}
$.ajax({
url: '/api/v1/submissions/',
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST',
success: function(submission){
// REDIRECT TO SUBMISSION PAGE
self.trigger('created', submission);
},
addedExistFile(attachment) {
const multiple = !!this.data.get('multiple');
const maxFiles = multiple ? this.data.get('max-files') : 1;
if (this.dropZone.files.length >= maxFiles) {
alert('Max files exceeded');
return;
}
/** todo: Дублируется дважды */
const file = {
id: attachment.id,
name: attachment.original_name,
size: attachment.size,
type: attachment.mime,
status: Dropzone.ADDED,
url: `${attachment.url}`,
data: attachment,
};
this.dropZone.emit('addedfile', file);
this.dropZone.emit('thumbnail', file, file.url);
this.dropZone.emit('complete', file);
this.dropZone.files.push(file);
this.resortElement();
}
}