diaspora/app/assets/javascripts/app/collections/comments.js
Dennis Collinson f6e3c1b88b seperate interactions from posts
Lazily load post interactions on show page
hella refactorz
2012-05-12 17:41:58 -07:00

24 lines
514 B
JavaScript

app.collections.Comments = Backbone.Collection.extend({
model: app.models.Comment,
url : function(){
return this.post.url() + "/comments"
},
initialize : function(models, options) {
this.post = options.post
},
make : function(text){
var self = this
var comment = new app.models.Comment({text: text })
, deferred = comment.save({}, {url : self.url()})
comment.set({author: app.currentUser.toJSON(), parent: self.post })
this.add(comment)
return deferred
}
});