Skip to content

Instantly share code, notes, and snippets.

@joegaudet
Created September 7, 2010 18:16
Show Gist options
  • Save joegaudet/568771 to your computer and use it in GitHub Desktop.
Save joegaudet/568771 to your computer and use it in GitHub Desktop.
addComment : function(source) {
var body = this.get('body');
if (!body) {
return; // no empty comments
}
var feedItem = this.get('feedItem');
this.invokeLater(function() {
var comment = DarkHorse.store.createRecord(DarkHorse.Comment, {
body : body,
feedItem : feedItem.get('guid'),
feedSourceGuid : feedItem.get('sourceGuid')
});
if(comment.commitRecord()){
console.log(this.get('content').toString());
this.get('content').pushObject(comment);
this.set('body', '');
this.set('isVisible', NO);
// DarkHorse.mainPage.mainPane.makeFirstResponder(null, null); // clear focus
}
}, 200); // let the button unpress
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment