Commit 41ef0d4a authored by Sindre Sorhus's avatar Sindre Sorhus

Merge pull request #545 from thebakeryio/feature/backbone-marionette-model-shortcuts

use Marionette's event hashes for Model and Collection events
parents 37174a69 dccfdac9
......@@ -48,9 +48,12 @@ TodoMVC.module('Layout', function (Layout, App, Backbone) {
'click #clear-completed': 'onClearClick'
},
collectionEvents: {
'all': 'updateCount'
},
initialize: function () {
this.listenTo(App.vent, 'todoList:filter', this.updateFilterSelection, this);
this.listenTo(this.collection, 'all', this.updateCount, this);
},
onRender: function () {
......
......@@ -23,8 +23,8 @@ TodoMVC.module('TodoList.Views', function (Views, App, Backbone, Marionette, $)
'click .toggle': 'toggle'
},
initialize: function () {
this.listenTo(this.model, 'change', this.render, this);
modelEvents: {
'change': 'render'
},
onRender: function () {
......@@ -93,8 +93,8 @@ TodoMVC.module('TodoList.Views', function (Views, App, Backbone, Marionette, $)
'click #toggle-all': 'onToggleAllClick'
},
initialize: function () {
this.listenTo(this.collection, 'all', this.update, this);
collectionEvents: {
'all' : 'update'
},
onRender: function () {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment