mirror of
https://github.com/fergalmoran/dss.git
synced 2025-12-22 09:38:18 +00:00
56 lines
1.6 KiB
JavaScript
Executable File
56 lines
1.6 KiB
JavaScript
Executable File
// Generated by CoffeeScript 1.4.0
|
|
(function() {
|
|
var __hasProp = {}.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; };
|
|
|
|
define(['utils', 'vent', 'models/comment/commentCollection', 'models/comment/commentItem', 'app.lib/backbone.dss.model'], function(utils, vent, CommentCollection, CommentItem, DssModel) {
|
|
var MixItem;
|
|
return MixItem = (function(_super) {
|
|
|
|
__extends(MixItem, _super);
|
|
|
|
function MixItem() {
|
|
return MixItem.__super__.constructor.apply(this, arguments);
|
|
}
|
|
|
|
MixItem.prototype.urlRoot = com.podnoms.settings.urlRoot + "mix/";
|
|
|
|
MixItem.prototype.relations = [
|
|
{
|
|
type: Backbone.Many,
|
|
key: "comments",
|
|
relatedModel: CommentItem
|
|
}
|
|
];
|
|
|
|
MixItem.prototype.addComment = function(comment, success, error) {
|
|
var c;
|
|
c = void 0;
|
|
if (comment) {
|
|
c = this.get("comments").create({
|
|
comment: comment,
|
|
mix_id: this.get("slug")
|
|
});
|
|
return c.save(null, {
|
|
success: function() {
|
|
return success();
|
|
},
|
|
error: function() {
|
|
return error();
|
|
}
|
|
});
|
|
} else {
|
|
return error("Comment cannot be empty");
|
|
}
|
|
};
|
|
|
|
MixItem;
|
|
|
|
|
|
return MixItem;
|
|
|
|
})(DssModel);
|
|
});
|
|
|
|
}).call(this);
|