change folder icon when dragging over a directory

This commit is contained in:
Vincent Chan 2016-06-15 01:03:59 +02:00
parent 937d21ed29
commit 203a07e7f3
3 changed files with 17 additions and 4 deletions

View File

@ -77,6 +77,10 @@
background-color: rgb(179, 230, 255); background-color: rgb(179, 230, 255);
} }
.dropping-to-dir .thumbnail {
background-image: url(/nextcloud/core/img/filetypes/folder-drag-accept.svg)!important;
}
/* icons for sidebar */ /* icons for sidebar */
.nav-icon-files { .nav-icon-files {
background-image: url('../img/folder.svg'); background-image: url('../img/folder.svg');

View File

@ -667,11 +667,22 @@ OC.Upload = {
OC.Upload._hideProgressBar(); OC.Upload._hideProgressBar();
} }
}); });
fileupload.on('fileuploaddragover', function(){ fileupload.on('fileuploaddragover', function(e, data){
$('#app-content').addClass('file-drag'); $('#app-content').addClass('file-drag');
var filerow = $(e.delegatedEvent.target).closest('tr');
if(!filerow.hasClass('dropping-to-dir')){
$('.dropping-to-dir').removeClass('dropping-to-dir');
}
if(filerow.attr('data-type') === 'dir'){
filerow.addClass('dropping-to-dir');
}
}); });
fileupload.on('fileuploaddragleave fileuploaddrop', function (){ fileupload.on('fileuploaddragleave fileuploaddrop', function (e, data){
$('#app-content').removeClass('file-drag'); $('#app-content').removeClass('file-drag');
$('.dropping-to-dir').removeClass('dropping-to-dir');
}); });
} else { } else {
// for all browsers that don't support the progress bar // for all browsers that don't support the progress bar

View File

@ -2528,9 +2528,7 @@
return false; return false;
} }
console.log(e);
var dropTarget = $(e.delegatedEvent.target); var dropTarget = $(e.delegatedEvent.target);
console.log(dropTarget);
// check if dropped inside this container and not another one // check if dropped inside this container and not another one
if (dropTarget.length if (dropTarget.length