CommentsView.prototype.addmycomment = function(comment) { var card = new CommentCard(comment); var container = this.find('.my-comments-list')[0]; this.mycomments.push(comment); card.appendTo(container); card.on('delete', this.bound('removemycomment')); };
CommentsView.prototype.add = function(comment) { var self = this; if( Array.isArray(comment) ) { comment.forEach(function(c){ this.add(c); }, this); return; } var card = new CommentCard(comment); this.comments.push(comment); var container = this.find('.comments-list')[0]; card.appendTo(container); card.on('delete', function(){ self.comments.splice(self.comments.indexOf(comment), 1); self.bound('refreshState')(); }); };