summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <roeland@famdouma.nl>2016-10-24 15:42:44 +0200
committerRoeland Jago Douma <roeland@famdouma.nl>2016-10-24 21:45:00 +0200
commit0abcc630a568768c614cc796ea04818d4a182b4e (patch)
treed466aeb52c1305d1c26ac688346b8fc4ecd037dd
parent7a6dbeb3986b76740a4b19ea3553118d226f51c7 (diff)
downloadnextcloud-server-0abcc630a568768c614cc796ea04818d4a182b4e.tar.gz
nextcloud-server-0abcc630a568768c614cc796ea04818d4a182b4e.zip
Fix public files_drop page
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
-rw-r--r--apps/files_sharing/js/files_drop.js24
1 files changed, 9 insertions, 15 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js
index aa993635b58..64051844d03 100644
--- a/apps/files_sharing/js/files_drop.js
+++ b/apps/files_sharing/js/files_drop.js
@@ -67,31 +67,25 @@
$('#drop-upload-done-indicator').addClass('hidden');
$('#drop-upload-progress-indicator').removeClass('hidden');
_.each(data['files'], function(file) {
- if(errors.length === 0) {
- $('#public-upload ul').append(output({isUploading: true, name: escapeHTML(file.name)}));
- $('[data-toggle="tooltip"]').tooltip();
- data.submit();
- } else {
- OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: file.name}));
- $('#public-upload ul').append(output({isUploading: false, name: escapeHTML(file.name)}));
- $('[data-toggle="tooltip"]').tooltip();
- }
+ $('#public-upload ul').append(output({isUploading: true, name: escapeHTML(file.name)}));
+ $('[data-toggle="tooltip"]').tooltip();
+ data.submit();
});
return true;
},
- success: function (response) {
- if(response.status !== 'error') {
- var mimeTypeUrl = OC.MimeType.getIconUrl(response['mimetype']);
- $('#public-upload ul li[data-name="' + escapeHTML(response['filename']) + '"]').html('<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + escapeHTML(response['filename']));
+ done: function(e, data) {
+ // Created
+ if (data.jqXHR.status === 201) {
+ var mimeTypeUrl = OC.MimeType.getIconUrl(data.files[0].type);
+ $('#public-upload ul li[data-name="' + escapeHTML(data.files[0].name) + '"]').html('<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + escapeHTML(data.files[0].name));
$('[data-toggle="tooltip"]').tooltip();
} else {
- var name = response[0]['data']['filename'];
+ var name = data.files[0].name;
OC.Notification.showTemporary(OC.L10N.translate('files_sharing', 'Could not upload "{filename}"', {filename: name}));
$('#public-upload ul li[data-name="' + escapeHTML(name) + '"]').html(output({isUploading: false, name: escapeHTML(name)}));
$('[data-toggle="tooltip"]').tooltip();
}
-
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);