diff options
author | Lukas Reschke <lukas@owncloud.com> | 2016-06-09 17:45:16 +0200 |
---|---|---|
committer | Lukas Reschke <lukas@owncloud.com> | 2016-06-09 17:55:26 +0200 |
commit | 6e99b0f59d3b0278c45d42dcec01ff554a89d979 (patch) | |
tree | e7f60f51f36517f15bd6a91e5d5bd1c1739f3d20 /apps/files_sharing/js/files_drop.js | |
parent | 5fdde426eb416b470bc37c86a518c49767a55251 (diff) | |
download | nextcloud-server-6e99b0f59d3b0278c45d42dcec01ff554a89d979.tar.gz nextcloud-server-6e99b0f59d3b0278c45d42dcec01ff554a89d979.zip |
Make uploading possible via select and cleanup CSS
Diffstat (limited to 'apps/files_sharing/js/files_drop.js')
-rw-r--r-- | apps/files_sharing/js/files_drop.js | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/apps/files_sharing/js/files_drop.js b/apps/files_sharing/js/files_drop.js index ced26fda220..3c1ccd63da5 100644 --- a/apps/files_sharing/js/files_drop.js +++ b/apps/files_sharing/js/files_drop.js @@ -15,24 +15,33 @@ // Prevent the default browser drop action: e.preventDefault(); }); - $('#publicUploadDiv').fileupload({ + $('#public-upload').fileupload({ url: OC.linkTo('files', 'ajax/upload.php'), dataType: 'json', - //maxFileSize: fileUploadContainer.data('maxupload'), - messages: { - maxFileSize: t('files_sharing', 'File is bigger than allowed.') - }, - dropZone: $('#publicUploadDiv'), + dropZone: $('#public-upload'), formData: { dirToken: $('#sharingToken').val() + }, + add: function(e, data) { + _.each(data['files'], function(file) { + $('#public-upload ul').append('<li data-name="'+escapeHTML(file.name)+'"><span class="icon-loading-small"></span> '+escapeHTML(file.name)+'</li>'); + }); + data.submit(); + }, + success: function (response) { + var mimeTypeUrl = OC.MimeType.getIconUrl(response['mimetype']); + $('#public-upload ul li[data-name="'+escapeHTML(response['filename'])+'"]').html('<img src="'+escapeHTML(mimeTypeUrl)+'"/> '+escapeHTML(response['filename'])); } }); - + $('#public-upload .button.icon-upload').click(function(e) { + e.preventDefault(); + $('#public-upload #emptycontent input').focus().trigger('click'); + }); } }; $(document).ready(function() { - if($('#uploadOnlyInterface').val() === "1") { + if($('#upload-only-interface').val() === "1") { $('.avatardiv').avatar($('#sharingUserId').val(), 128, true); } |