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