2014-07-07 10:09:12 -07:00
|
|
|
CocoModel = require 'models/CocoModel'
|
|
|
|
|
2014-01-03 10:32:13 -08:00
|
|
|
module.exports = class CocoCollection extends Backbone.Collection
|
|
|
|
loaded: false
|
2014-07-07 10:09:12 -07:00
|
|
|
model: null
|
2014-01-03 10:32:13 -08:00
|
|
|
|
|
|
|
initialize: ->
|
2014-07-07 10:09:12 -07:00
|
|
|
if not @model
|
|
|
|
console.error @constructor.name, 'does not have a model defined. This will not do!'
|
2014-01-03 10:32:13 -08:00
|
|
|
super()
|
|
|
|
@once 'sync', =>
|
|
|
|
@loaded = true
|
2014-04-26 12:54:03 -07:00
|
|
|
model.loaded = true for model in @models
|
|
|
|
|
|
|
|
getURL: ->
|
2014-05-02 10:31:20 -07:00
|
|
|
return if _.isString @url then @url else @url()
|
|
|
|
|
|
|
|
fetch: ->
|
|
|
|
@jqxhr = super(arguments...)
|
|
|
|
@loading = true
|
|
|
|
@jqxhr
|