19 lines
471 B
Plaintext
19 lines
471 B
Plaintext
Backbone.Collection.prototype.ensureFetched = (callback) ->
|
|
if (@_alreadyEnsureFetched)
|
|
_refresher =>
|
|
this.unbind('refresh', _refresher)
|
|
callback.apply(this)
|
|
@_alreadyEnsureFetched = true
|
|
this.bind('refresh', _refresher)
|
|
this.fetch()
|
|
else
|
|
callback.apply(this)
|
|
|
|
Backbone.View.prototype.attributes = ->
|
|
attrs = {}
|
|
for field in @attributeFields
|
|
do (field) =>
|
|
attrs[field] = this.$("input[name='#{field}']").val()
|
|
attrs
|
|
|