summaryrefslogtreecommitdiffstats
path: root/apps/files_sharing/js
diff options
context:
space:
mode:
authorArtur Neumann <info@individual-it.net>2017-04-27 11:47:40 +0545
committerArtur Neumann <info@individual-it.net>2017-04-27 14:16:55 +0545
commitf2f2e7b6fb6558c0976b7fdeafda2d8aa49850a3 (patch)
tree29cd670f5d7f6de1f3e358fae611b5a484a12958 /apps/files_sharing/js
parent79c760a10c0befd868f9e1d2cc2f540125495efa (diff)
downloadnextcloud-server-f2f2e7b6fb6558c0976b7fdeafda2d8aa49850a3.tar.gz
nextcloud-server-f2f2e7b6fb6558c0976b7fdeafda2d8aa49850a3.zip
some small refactoring and reformating
Signed-off-by: Artur Neumann <info@individual-it.net>
Diffstat (limited to 'apps/files_sharing/js')
-rw-r--r--apps/files_sharing/js/files_drop.js22
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js
index 30de278484c..f1fc71c6ce2 100644
--- a/apps/files_sharing/js/files_drop.js
+++ b/apps/files_sharing/js/files_drop.js
@@ -72,18 +72,25 @@
return true;
},
+ setFileIcon: function (fileName,fileIcon) {
+ $('#public-upload ul li[data-name="' + fileName + '"]').html(fileIcon);
+ $('[data-toggle="tooltip"]').tooltip();
+ },
+
initialize: function () {
$(document).bind('drop dragover', function (e) {
// Prevent the default browser drop action:
e.preventDefault();
});
var output = this.template();
+ var fileName = undefined;
$('#public-upload').fileupload({
type: 'PUT',
dropZone: $('#public-upload'),
sequentialUploads: true,
add: function(e, data) {
Drop.addFileToUpload(e, data);
+ fileName = escapeHTML(data.files[0].name);
//we return true to keep trying to upload next file even
//if addFileToUpload did not like the privious one
return true;
@@ -91,14 +98,17 @@
done: function(e, data) {
// Created
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();
+ var fileIcon = '<img src="' + escapeHTML(mimeTypeUrl) + '"/> ' + fileName;
+ Drop.setFileIcon(fileName,fileIcon);
},
fail: function(e, data, errorThrown) {
- 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();
+ OC.Notification.showTemporary(OC.L10N.translate(
+ 'files_sharing',
+ 'Could not upload "{filename}"',
+ {filename: fileName}
+ ));
+ var fileIcon = output({isUploading: false, name: fileName});
+ Drop.setFileIcon(fileName,fileIcon);
},
progressall: function (e, data) {
var progress = parseInt(data.loaded / data.total * 100, 10);