diff options
author | Vincent Petry <pvince81@owncloud.com> | 2014-04-04 18:46:08 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2014-04-28 14:55:01 +0200 |
commit | fd982df6aea09492e02cc65de02ee8250a1a229c (patch) | |
tree | e3ed5de2072c3110147db0c411e153e98d0abf32 /apps/files/js/files.js | |
parent | a952d80ad9e57931f6a8fcb94ef6cab4f982149c (diff) | |
download | nextcloud-server-fd982df6aea09492e02cc65de02ee8250a1a229c.tar.gz nextcloud-server-fd982df6aea09492e02cc65de02ee8250a1a229c.zip |
Fixed selection to be based on FileList.files
The file selection is now based on the internal model array
FileList.files instead of the visible checkboxes.
This makes it possible to virtually select files that haven't been
rendered yet (select all, then deselect a visible one)
Added more unit tests for selection (with shift and ctrl as well)
Diffstat (limited to 'apps/files/js/files.js')
-rw-r--r-- | apps/files/js/files.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/apps/files/js/files.js b/apps/files/js/files.js index 6cb0d41a611..41c762f0fa1 100644 --- a/apps/files/js/files.js +++ b/apps/files/js/files.js @@ -313,19 +313,15 @@ var createDragShadow = function(event) { var isDragSelected = $(event.target).parents('tr').find('td input:first').prop('checked'); if (!isDragSelected) { //select dragged file - $(event.target).parents('tr').find('td input:first').prop('checked',true); + FileList._selectFileEl($(event.target).parents('tr:first'), true); } - var selectedFiles = FileList.getSelectedFiles(); + // do not show drag shadow for too many files + var selectedFiles = _.first(FileList.getSelectedFiles(), FileList.pageSize); if (!isDragSelected && selectedFiles.length === 1) { //revert the selection - $(event.target).parents('tr').find('td input:first').prop('checked',false); - } - - //also update class when we dragged more than one file - if (selectedFiles.length > 1) { - $(event.target).parents('tr').addClass('selected'); + FileList._selectFileEl($(event.target).parents('tr:first'), false); } // build dragshadow |