48 lines
1.6 KiB
JavaScript
48 lines
1.6 KiB
JavaScript
class SubmissionFormUploadDialog extends EICDialogContent {
|
|
|
|
actions = [
|
|
{
|
|
label: 'Cancel',
|
|
onclick: this.cancel.bind(this),
|
|
severity: 'secondary',
|
|
role: 'cancel'
|
|
},
|
|
]
|
|
|
|
DOMContentLoaded(options) {
|
|
this.filename = options.filename
|
|
this.pic = options.pic
|
|
this.pid = options.pid
|
|
this.fileUploader = this.find('.file_uploader')
|
|
this.AwsFileUpload = new AwsFileUpload(this.fileUploader, {
|
|
getSignedUrl : options.getSignedUrl,
|
|
getSignedMethod : options.getSignedMethod,
|
|
uploadUrl: options.UploadUrl, // Still needed ??
|
|
uploadMethod: options.UploadMethod, // Still needed ??
|
|
allowedExtensions: options.allowedExtensions,
|
|
allowedMimes: options.allowedMimes,
|
|
allowDrop: true,
|
|
maxFiles: 1,
|
|
minFiles: 1,
|
|
maxSize: 1024*1024*1024,
|
|
dndLabel: options.message,
|
|
|
|
filename: options.filename,
|
|
pic: options.pic,
|
|
pid: options.pid,
|
|
});
|
|
this.AwsFileUpload.onWrongFileType = (file) => {
|
|
ui.growl.append('You file is either of an unsupported format, or is too heavy (more than 1GB).', 'warning');
|
|
}
|
|
this.AwsFileUpload.onUploadOneEnd = this.finishedUpload.bind(this)
|
|
}
|
|
|
|
finishedUpload(fileObj) {
|
|
this.commit({
|
|
fileName: this.AwsFileUpload.filename,
|
|
pitchName: fileObj.name
|
|
})
|
|
}
|
|
}
|
|
|
|
app.registerClass('SubmissionFormUploadDialog', SubmissionFormUploadDialog); |