-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
74 lines (74 loc) · 2.39 KB
/
app.js
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
(function() {
var __hasProp = Object.prototype.hasOwnProperty, __extends = function(child, parent) {
for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; }
function ctor() { this.constructor = child; }
ctor.prototype = parent.prototype;
child.prototype = new ctor;
child.__super__ = parent.prototype;
return child;
};
Backbone.ParseCollection = (function() {
__extends(ParseCollection, Backbone.Collection);
function ParseCollection() {
ParseCollection.__super__.constructor.apply(this, arguments);
}
ParseCollection.prototype.parse = function(resp, xhr) {
var data;
data = ParseCollection.__super__.parse.apply(this, arguments);
return data.results;
};
ParseCollection.prototype.fetch = function(options) {
if ((options != null ? options.query : void 0) != null) {
options.data = "where=" + JSON.stringify(options.query);
delete options.query;
}
return ParseCollection.__super__.fetch.apply(this, arguments);
};
return ParseCollection;
})();
Backbone.ParseModel = (function() {
__extends(ParseModel, Backbone.Model);
ParseModel.prototype.setId = function(data) {
if (!data.id) {
data.id = data.objectId;
}
return data;
};
function ParseModel(model) {
this.setId(model);
ParseModel.__super__.constructor.apply(this, arguments);
}
ParseModel.prototype.parse = function(resp, xhr) {
return this.setId(ParseModel.__super__.parse.apply(this, arguments));
};
ParseModel.prototype.toJSON = function() {
var result;
result = ParseModel.__super__.toJSON.apply(this, arguments);
delete result.createdAt;
delete result.updatedAt;
return result;
};
return ParseModel;
})();
window.app = {
models: {},
collections: {}
};
app.models.Person = (function() {
__extends(Person, Backbone.ParseModel);
function Person() {
Person.__super__.constructor.apply(this, arguments);
}
Person.prototype.urlRoot = "/data/People";
return Person;
})();
app.collections.People = (function() {
__extends(People, Backbone.ParseCollection);
function People() {
People.__super__.constructor.apply(this, arguments);
}
People.prototype.model = app.models.Person;
People.prototype.url = "/data/People";
return People;
})();
}).call(this);