summaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2015-09-25 12:23:28 +0200
committerVincent Petry <pvince81@owncloud.com>2015-09-28 15:23:37 +0200
commitf9acf4627e2c85150f1c0001d4df4ade41cbb458 (patch)
tree369da8648021d96c33a19644018bf454ea38a8f3 /apps/files/js/files.js
parentd68079f93210f8fe0b5327e686497db97fde6a3e (diff)
downloadnextcloud-server-f9acf4627e2c85150f1c0001d4df4ade41cbb458.tar.gz
nextcloud-server-f9acf4627e2c85150f1c0001d4df4ade41cbb458.zip
Fix sidebar interaction
- Clicking a file row or selecting it will open the sidebar. - When sidebar is open, its contents update with the last selection. - Dragging doesn't open the sidebar but does update its contents if it was open already. - Switching folders closes the sidebar. - Close sidebar when highlighted file got deleted/removed from list
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r--apps/files/js/files.js21
1 files changed, 8 insertions, 13 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js
index 4fdc9eb2110..9ab7609cc40 100644
--- a/apps/files/js/files.js
+++ b/apps/files/js/files.js
@@ -356,7 +356,7 @@ var createDragShadow = function(event) {
var isDragSelected = $(event.target).parents('tr').find('td input:first').prop('checked');
if (!isDragSelected) {
//select dragged file
- FileList._selectFileEl($(event.target).parents('tr:first'), true);
+ FileList._selectFileEl($(event.target).parents('tr:first'), true, false);
}
// do not show drag shadow for too many files
@@ -365,7 +365,7 @@ var createDragShadow = function(event) {
if (!isDragSelected && selectedFiles.length === 1) {
//revert the selection
- FileList._selectFileEl($(event.target).parents('tr:first'), false);
+ FileList._selectFileEl($(event.target).parents('tr:first'), false, false);
}
// build dragshadow
@@ -413,22 +413,17 @@ var dragOptions={
cursor: 'move',
start: function(event, ui){
var $selectedFiles = $('td.filename input:checkbox:checked');
- if($selectedFiles.length > 1){
- $selectedFiles.parents('tr').fadeTo(250, 0.2);
- }
- else{
- $(this).fadeTo(250, 0.2);
+ if (!$selectedFiles.length) {
+ $selectedFiles = $(this);
}
+ $selectedFiles.closest('tr').fadeTo(250, 0.2).addClass('dragging');
},
stop: function(event, ui) {
var $selectedFiles = $('td.filename input:checkbox:checked');
- if($selectedFiles.length > 1){
- $selectedFiles.parents('tr').fadeTo(250, 1);
- }
- else{
- $(this).fadeTo(250, 1);
+ if (!$selectedFiles.length) {
+ $selectedFiles = $(this);
}
- $('#fileList tr td.filename').addClass('ui-draggable');
+ $selectedFiles.closest('tr').fadeTo(250, 1).removeClass('dragging');
}
};
// sane browsers support using the distance option