Skip to content

Instantly share code, notes, and snippets.

@ignu
Created July 20, 2011 23:23
Show Gist options
  • Save ignu/1096171 to your computer and use it in GitHub Desktop.
Save ignu/1096171 to your computer and use it in GitHub Desktop.
window.ConsoleDay = Backbone.Model.extend({
initialize: function() {
_.bindAll(this, 'addWearing', 'addWearings', 'updateWearingsCount', 'getDiv');
this.wearings = new WearingCollection;
this.wearings.url = "/days/" + this.get("date") + "/wearings";
this.wearings.bind("add", this.updateWearingsCount);
this.wearings.fetch();
},
updateWearingsCount : function() {
this.getDiv().find(".item_count").text("(" + this.wearings.length + " items)");
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment