drag to trash

This commit is contained in:
Antelle 2015-11-15 23:26:37 +03:00
parent b5aebd7917
commit 30618cf88e
3 changed files with 9 additions and 3 deletions

View File

@ -7,7 +7,7 @@ Nov
- [ ] minimize to tray
- [ ] trim history by rules
- [ ] custom icons, favicons
- [ ] drag to trash
- [x] drag to trash
- [ ] switch view
- [ ] option to check updates without install

View File

@ -26,7 +26,8 @@ var MenuModel = Backbone.Model.extend({
this.tagsSection = new MenuSectionModel(defTags);
this.tagsSection.set({ scrollable: true, drag: true });
this.tagsSection.defaultItems = defTags;
this.trashSection = new MenuSectionModel([{ title: 'Trash', icon: 'trash', shortcut: Keys.DOM_VK_D, filterKey: 'trash', filterValue: true }]);
this.trashSection = new MenuSectionModel([{ title: 'Trash', icon: 'trash', shortcut: Keys.DOM_VK_D,
filterKey: 'trash', filterValue: true, drop: true }]);
Colors.AllColors.forEach(function(color) { this.colorsSection.get('items').models[0]
.addOption({ cls: 'fa ' + color + '-color', value: color, filterValue: color }); }, this);
this.menus.app = new MenuSectionCollection([

View File

@ -200,7 +200,12 @@ var MenuItemView = Backbone.View.extend({
e.stopPropagation();
if (this.model.get('drop') && this.dropAllowed(e)) {
this.$el.removeClass('menu__item--drag');
this.model.moveHere(DragDropInfo.dragObject);
if (this.model.get('filterKey') === 'trash') {
DragDropInfo.dragObject.moveToTrash();
Backbone.trigger('refresh');
} else {
this.model.moveHere(DragDropInfo.dragObject);
}
Backbone.trigger('refresh');
}
}