Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created July 15, 2010 17:02
Show Gist options
  • Save joegaudet/477212 to your computer and use it in GitHub Desktop.
Save joegaudet/477212 to your computer and use it in GitHub Desktop.
addComment: function(source){
console.log("Add Coment!");
var commentBox = source.getPath('parentView.parentView');
var body = commentBox.getPath('commentControl.content.value');
var feedItem = commentBox.get('feedItem');
var user = DarkHorse.store.find(DarkHorse.User,DarkHorse.currentUser.get('guid'));
var comment = DarkHorse.store.createRecord(DarkHorse.Comment,{
body: body,
user: user,
feedItem: feedItem
});
feedItem.get('comments').addInverseRecord(comment);
user.get('comments').addInverseRecord(comment);
commentBox.setPath('commentControl.content.value',"");
DarkHorse.store.commitRecords();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment