removeTodo: function() { var todoTags = this.model.get('tags'); // Decrease count/remove model for each tag of the todo (for guests) this.model.get('tags').forEach(function(tag) { GuestTags.removeTag(tag); }); // Destroy the model tags removed automatically on the backend. this.model.destroy(); // Fetch tags from server so count on view is updated. Tags.fetch({reset: true}); this.render(); this.$el.slideUp({duration: "slow", easing: "easeInOutBack"}); Backbone.eventBus.trigger('todoRemoved'); },
toggleDone: function() { var done = this.model.get('done'); this.model.save({'done': !done}); Backbone.eventBus.trigger('statusChanged'); },
error: function() { Backbone.eventBus.trigger('guestMode'); }
success: function() { Backbone.eventBus.trigger('userMode'); },
change: function() { Backbone.eventBus.trigger('routeChanged'); },
filterTag: function() { Backbone.eventBus.trigger('filterTag'); },
filterNotDone: function() { Backbone.eventBus.trigger('filterNotDone'); },
filterAll: function() { Backbone.eventBus.trigger('filterAll'); },