Skip to content

Commit

Permalink
Merge pull request tastejs#545 from thebakeryio/feature/backbone-mari…
Browse files Browse the repository at this point in the history
…onette-model-shortcuts

use Marionette's event hashes for Model and Collection events
  • Loading branch information
sindresorhus committed May 5, 2013
2 parents 37174a6 + dccfdac commit 41ef0d4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 () {
Expand Down Expand Up @@ -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 () {
Expand Down

0 comments on commit 41ef0d4

Please sign in to comment.