Added Trash-Dropzone to easily dispose of files and folders

Signed-off-by: Felix Nüsse <Felix.nuesse@t-online.de>
This commit is contained in:
Felix Nüsse 2018-08-28 18:21:46 +02:00 committed by John Molakvoæ (skjnldsv)
parent 77c6e41063
commit 2b0fbf7b89
No known key found for this signature in database
GPG Key ID: 60C25B8C072916CF
2 changed files with 25 additions and 0 deletions

View File

@ -342,6 +342,14 @@
this.$fileList.on('click','td.filename>a.name, td.filesize, td.date', _.bind(this._onClickFile, this));
$.event.trigger({type: "droppedOnTrash"});
var self=this;
this.$fileList.on("droppedOnTrash", function (event, filename, directory) {
//self.fileActions.triggerAction('Favorite', self.getModelForFile(file), self);
self.do_delete(filename, directory)
});
this.$fileList.on('change', 'td.selection>.selectCheckBox', _.bind(this._onClickFileCheckbox, this));
this.$el.on('show', _.bind(this._onShow, this));
this.$el.on('urlChanged', _.bind(this._onUrlChanged, this));

View File

@ -64,6 +64,23 @@
_setupEvents: function () {
this.$el.on('click', 'li a', _.bind(this._onClickItem, this))
this.$el.on('click', 'li button', _.bind(this._onClickMenuButton, this));
$(".nav-trashbin").droppable({
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"));
}
}
}
});
},
/**