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>
This commit is contained in:
parent
66b908f9f2
commit
371df903d6
|
@ -84,16 +84,15 @@
|
|||
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 {
|
||||
// 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'));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in New Issue