-
Notifications
You must be signed in to change notification settings - Fork 0
/
collection.coffee
58 lines (41 loc) · 1.18 KB
/
collection.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
'use strict'
define (require) ->
_ = require 'underscore'
Backbone = require 'backbone'
Phos = {}
Helpers = require "./helpers/_helpers_"
###
Abstraction of the Backbone Collection
###
class Phos.Collection extends Backbone.Collection
###
Console logging
@property {Phos.Helpers.Logger}
###
logger = new Helpers.Logger()
###
The Model to use for this Collection.
The Model name must be a different name than the Collection. It is preferrable
and best practice that the Collection is the plural version of the name used
for the Model.
eg. Collection --> People, Model --> Person
@property {Phos.Model}
###
model: null
###
Collection Url
Set the url property (or function) on a collection to reference its location
on the server. Models within the collection will use url to construct URLs
of their own.
@property {String/Function}
###
url: null
###
Constructor
@param json {Object}
###
constructor: (json) ->
unless @model?
return logger.error @constructor.name,
'Please provide a Model to the Collection.'
return super