fix up collection view
This commit is contained in:
parent
d7a77e672b
commit
755ffdb6c0
|
@ -4,8 +4,8 @@ Backbone.Collection.prototype.ensureFetched = (callback) ->
|
||||||
this.unbind('refresh', _refresher)
|
this.unbind('refresh', _refresher)
|
||||||
callback.apply(this)
|
callback.apply(this)
|
||||||
@_alreadyEnsureFetched = true
|
@_alreadyEnsureFetched = true
|
||||||
@bind('refresh', _refresher)
|
this.bind('refresh', _refresher)
|
||||||
@fetch()
|
this.fetch()
|
||||||
else
|
else
|
||||||
callback.apply(this)
|
callback.apply(this)
|
||||||
|
|
||||||
|
|
|
@ -4,10 +4,7 @@ class window.<%= plural_object_name %>View extends Backbone.View
|
||||||
}
|
}
|
||||||
template: JST['<%= plural_underscore_name %>/list']
|
template: JST['<%= plural_underscore_name %>/list']
|
||||||
initialize: ->
|
initialize: ->
|
||||||
@collection.bind('refresh', @addAll)
|
@collection.bind('refresh', this.addAll)
|
||||||
|
|
||||||
this.render()
|
|
||||||
@collection.fetch
|
|
||||||
render: =>
|
render: =>
|
||||||
$(this.el).html(this.template())
|
$(this.el).html(this.template())
|
||||||
this
|
this
|
||||||
|
|
Loading…
Reference in New Issue