summaryrefslogtreecommitdiffstats
path: root/apps/files/js/files.js
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2014-04-04 18:46:08 +0200
committerVincent Petry <pvince81@owncloud.com>2014-04-28 14:55:01 +0200
commitfd982df6aea09492e02cc65de02ee8250a1a229c (patch)
treee3ed5de2072c3110147db0c411e153e98d0abf32 /apps/files/js/files.js
parenta952d80ad9e57931f6a8fcb94ef6cab4f982149c (diff)
downloadnextcloud-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.js12
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