From 755ffdb6c0cf987067c82aef962f891a61ab1350 Mon Sep 17 00:00:00 2001 From: John Bintz Date: Fri, 13 May 2011 10:04:42 -0400 Subject: [PATCH] fix up collection view --- templates/app_helper.coffee.erb | 4 ++-- templates/collection_view.coffee.erb | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/templates/app_helper.coffee.erb b/templates/app_helper.coffee.erb index 686bd70..73ba134 100644 --- a/templates/app_helper.coffee.erb +++ b/templates/app_helper.coffee.erb @@ -4,8 +4,8 @@ Backbone.Collection.prototype.ensureFetched = (callback) -> this.unbind('refresh', _refresher) callback.apply(this) @_alreadyEnsureFetched = true - @bind('refresh', _refresher) - @fetch() + this.bind('refresh', _refresher) + this.fetch() else callback.apply(this) diff --git a/templates/collection_view.coffee.erb b/templates/collection_view.coffee.erb index a27919b..a99b2a9 100644 --- a/templates/collection_view.coffee.erb +++ b/templates/collection_view.coffee.erb @@ -4,10 +4,7 @@ class window.<%= plural_object_name %>View extends Backbone.View } template: JST['<%= plural_underscore_name %>/list'] initialize: -> - @collection.bind('refresh', @addAll) - - this.render() - @collection.fetch + @collection.bind('refresh', this.addAll) render: => $(this.el).html(this.template()) this