Merge pull request #16984 from nextcloud/bugfix/noid/warn-during-upload-drop
Warn user before closing when uploading a file on a upload only link
This commit is contained in:
commit
803c8ddf7f
|
@ -14,6 +14,9 @@
|
|||
/** @type {Function} **/
|
||||
_template: undefined,
|
||||
|
||||
/** @type {bool} */
|
||||
_uploading: false,
|
||||
|
||||
addFileToUpload: function(e, data) {
|
||||
var errors = [];
|
||||
var output = this.template();
|
||||
|
@ -79,10 +82,17 @@
|
|||
e.preventDefault();
|
||||
});
|
||||
var output = this.template();
|
||||
var self = this;
|
||||
$('#public-upload').fileupload({
|
||||
type: 'PUT',
|
||||
dropZone: $('#public-upload'),
|
||||
sequentialUploads: true,
|
||||
start: function(e) {
|
||||
self._uploading = true;
|
||||
},
|
||||
stop: function(e) {
|
||||
self._uploading = false;
|
||||
},
|
||||
add: function(e, data) {
|
||||
Drop.addFileToUpload(e, data);
|
||||
//we return true to keep trying to upload next file even
|
||||
|
@ -120,6 +130,9 @@
|
|||
e.preventDefault();
|
||||
$('#public-upload #emptycontent input').focus().trigger('click');
|
||||
});
|
||||
window.onbeforeunload = function() {
|
||||
return self.confirmBeforeUnload();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -128,7 +141,13 @@
|
|||
*/
|
||||
template: function () {
|
||||
return OCA.Sharing.Templates['files_drop'];
|
||||
},
|
||||
|
||||
confirmBeforeUnload: function() {
|
||||
if (this._uploading) {
|
||||
return t('files', 'This will stop your current uploads.')
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
OCA.FilesSharingDrop = Drop;
|
||||
|
|
Loading…
Reference in New Issue