summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMorris Jobke <morris.jobke@gmail.com>2013-10-16 04:52:35 -0700
committerMorris Jobke <morris.jobke@gmail.com>2013-10-16 04:52:35 -0700
commitdb31541fe13510ca4d1b752d7ac5a08ea8e89310 (patch)
treeff612a010a812919490483502423066d41b2bbdb /apps
parentfa3a65aea786fc2c2e2023436feb35ea64edc57a (diff)
parentc6f14001bb2ca1b035760e62c57281b164e55795 (diff)
downloadnextcloud-server-db31541fe13510ca4d1b752d7ac5a08ea8e89310.tar.gz
nextcloud-server-db31541fe13510ca4d1b752d7ac5a08ea8e89310.zip
Merge pull request #5353 from owncloud/files-dndtodirbroken
Fixed drag and drop to subfolder and breadcrumb
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/filelist.js36
1 files changed, 22 insertions, 14 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js
index ccc4b1401ad..e7edd2cf388 100644
--- a/apps/files/js/filelist.js
+++ b/apps/files/js/filelist.js
@@ -685,28 +685,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
- var parentDir = formArray[2]['value'];
- if (parentDir === '/') {
- formArray[2]['value'] += dir;
- } else {
- formArray[2]['value'] += '/' + dir;
- }
-
- return formArray;
+ return [
+ {name: 'dir', value: dir},
+ {name: 'requesttoken', value: oc_requesttoken}
+ ];
};
}
@@ -784,6 +788,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');