summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2013-10-15 16:14:23 +0200
committerVincent Petry <pvince81@owncloud.com>2013-10-15 16:14:23 +0200
commitc6f14001bb2ca1b035760e62c57281b164e55795 (patch)
tree4a471b8d7154a3c55ebc532d179bf25a7a08a7df /apps
parent92e646413a8b2df3c16306b75deab506b6eb4ec2 (diff)
downloadnextcloud-server-c6f14001bb2ca1b035760e62c57281b164e55795.tar.gz
nextcloud-server-c6f14001bb2ca1b035760e62c57281b164e55795.zip
Fixed drag and drop upload to breadcrumb
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js48
1 files changed, 22 insertions, 26 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index 02de2f2415e..fa26e2bfb7e 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -684,40 +684,32 @@ $(document).ready(function(){
file_upload_start.on('fileuploaddrop', function(e, data) {
OC.Upload.log('filelist handle fileuploaddrop', e, data);
- var dropTarget = $(e.originalEvent.target).closest('tr');
- if(dropTarget && dropTarget.data('type') === 'dir') { // drag&drop upload to folder
+ var dropTarget = $(e.originalEvent.target).closest('tr, .crumb');
+ if(dropTarget && (dropTarget.data('type') === 'dir' || dropTarget.hasClass('crumb'))) { // drag&drop upload to folder
// remember as context
data.context = dropTarget;
var dir = dropTarget.data('file');
+ // if from file list, need to prepend parent dir
+ if (dir){
+ var parentDir = $('#dir').val() || '/';
+ if (parentDir[parentDir.length - 1] != '/'){
+ parentDir += '/';
+ }
+ dir = parentDir + dir;
+ }
+ else{
+ // read full path from crumb
+ dir = dropTarget.data('dir') || '/';
+ }
// update folder in form
data.formData = function(form) {
- var formArray = form.serializeArray();
- // array index 0 contains the max files size
- // array index 1 contains the request token
- // array index 2 contains the directory
- if (formArray.length){
- var parentDir = formArray[2]['value'];
- if (parentDir === '/') {
- formArray[2]['value'] += dir;
- } else {
- formArray[2]['value'] += '/' + dir;
- }
- }
- else{
- var parentDir = $('#dir').val() || '';
- if (parentDir[parentDir.length - 1] != '/'){
- parentDir += '/';
- }
- return [
- {name: 'dir', value: parentDir + dir},
- {name: 'requesttoken', value: oc_requesttoken}
- ];
- }
-
- return formArray;
+ return [
+ {name: 'dir', value: dir},
+ {name: 'requesttoken', value: oc_requesttoken}
+ ];
};
}
@@ -795,6 +787,10 @@ $(document).ready(function(){
data.context.find('td.filesize').text(humanFileSize(size));
} else {
+ // only append new file if dragged onto current dir's crumb (last)
+ if (data.context && data.context.hasClass('crumb') && !data.context.hasClass('last')){
+ return;
+ }
// add as stand-alone row to filelist
var size=t('files', 'Pending');