summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDaniel Calviño Sánchez <danxuliu@gmail.com>2019-01-31 20:35:20 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2019-02-01 00:56:50 +0100
commit8680ced1aea4128c5aa1e1e2490259f6501f30bf (patch)
treee10c3b59435583429e3e6ae01baedd30b42713fa /apps
parente46a67ef4c356e7fadababe726c6d1a7fed1ed30 (diff)
downloadnextcloud-server-8680ced1aea4128c5aa1e1e2490259f6501f30bf.tar.gz
nextcloud-server-8680ced1aea4128c5aa1e1e2490259f6501f30bf.zip
Unify handling of dropping one file or several files on the trash bin
When a single file was dropped on the trash bin the file information was gotten from the original element in the file list. When several files were dropped on the trash bin the file information was gotten from the helper elements being dragged around. The helper element also contain the needed file information when a single file is being dragged, so the handling was unified to always get the file information from the helper elements. As the handling of several files is the same as before there is still the issue of only deleting those files shown in the drag helper instead of all the selected files. Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files/js/navigation.js15
1 files changed, 7 insertions, 8 deletions
diff --git a/apps/files/js/navigation.js b/apps/files/js/navigation.js
index 6f09124a886..538865ad5b1 100644
--- a/apps/files/js/navigation.js
+++ b/apps/files/js/navigation.js
@@ -84,14 +84,13 @@
drop: function (event, ui) {
var $selectedFiles = $(ui.draggable);
- if (ui.helper.find('tr').size() === 1) {
- var $tr = $selectedFiles.closest('tr');
- $selectedFiles.trigger('droppedOnTrash', $tr.attr('data-file'), $tr.attr('data-dir'));
- } else {
- var item = ui.helper.find('tr');
- for (var i = 0; i < item.length; i++) {
- $selectedFiles.trigger('droppedOnTrash', item[i].getAttribute('data-file'), item[i].getAttribute('data-dir'));
- }
+ // FIXME: when there are a lot of selected files the helper
+ // contains only a subset of them; the list of selected
+ // files should be gotten from the file list instead to
+ // ensure that all of them are removed.
+ var item = ui.helper.find('tr');
+ for (var i = 0; i < item.length; i++) {
+ $selectedFiles.trigger('droppedOnTrash', item[i].getAttribute('data-file'), item[i].getAttribute('data-dir'));
}
}
});