Loading template/app/model/Comment.js +20 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ Ext.define('Docs.model.Comment', { /** * Marks the comment as read. */ markRead: function(cfg) { markRead: function() { this.request({ url: '/comments/' + this.get("id") + '/read', method: 'POST', Loading @@ -116,6 +116,25 @@ Ext.define('Docs.model.Comment', { }); }, /** * Removes tag from comment. * @param {String} tagname */ removeTag: function(tagname) { this.request({ url: '/comments/' + this.get("id") + '/remove_tag', method: 'POST', params: { tagname: tagname }, success: function() { Ext.Array.remove(this.get("tags"), tagname); this.commit(); }, scope: this }); }, request: function(cfg) { Docs.Comments.request("ajax", { url: cfg.url, Loading template/app/view/comments/List.js +15 −3 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ Ext.define('Docs.view.comments.List', { this.delegateClick("a.voteCommentDown", function(el, r) { this.vote(el, r, "down"); }, this); this.delegateClick("a.editComment", function(el, r) { this.edit(el, r); }, this); Loading @@ -64,9 +65,11 @@ Ext.define('Docs.view.comments.List', { this.delegateClick("a.undoDeleteComment", function(el, r) { this.setDeleted(el, r, false); }, this); this.delegateClick("a.readComment", function(el, r) { this.markRead(el, r); }, this); this.delegateClick("a.readComment", this.markRead, this); this.delegateClick("a.add-tag", this.addTag, this); this.delegateClick("a.remove-tag", this.removeTag, this); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -129,6 +132,15 @@ Ext.define('Docs.view.comments.List', { comment.markRead(); }, addTag: function(el, comment) { // TODO... }, removeTag: function(el, comment) { var tagname = Ext.get(el).up(".tag").down("b").getHTML(); comment.removeTag(tagname); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading template/app/view/comments/Template.js +2 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,8 @@ Ext.define('Docs.view.comments.Template', { '<div class="top-right">', '<tpl for="tags">', '<span href="#" class="tag">', '{.}', '<tpl if="this.isMod()"><a href="#" class="delete" title="Delete tag">–</a></tpl>', '<b>{.}</b>', '<tpl if="this.isMod()"><a href="#" class="remove-tag" title="Delete tag">–</a></tpl>', '</span>', '</tpl>', '<tpl if="this.isMod()">', Loading Loading
template/app/model/Comment.js +20 −1 Original line number Diff line number Diff line Loading @@ -104,7 +104,7 @@ Ext.define('Docs.model.Comment', { /** * Marks the comment as read. */ markRead: function(cfg) { markRead: function() { this.request({ url: '/comments/' + this.get("id") + '/read', method: 'POST', Loading @@ -116,6 +116,25 @@ Ext.define('Docs.model.Comment', { }); }, /** * Removes tag from comment. * @param {String} tagname */ removeTag: function(tagname) { this.request({ url: '/comments/' + this.get("id") + '/remove_tag', method: 'POST', params: { tagname: tagname }, success: function() { Ext.Array.remove(this.get("tags"), tagname); this.commit(); }, scope: this }); }, request: function(cfg) { Docs.Comments.request("ajax", { url: cfg.url, Loading
template/app/view/comments/List.js +15 −3 Original line number Diff line number Diff line Loading @@ -55,6 +55,7 @@ Ext.define('Docs.view.comments.List', { this.delegateClick("a.voteCommentDown", function(el, r) { this.vote(el, r, "down"); }, this); this.delegateClick("a.editComment", function(el, r) { this.edit(el, r); }, this); Loading @@ -64,9 +65,11 @@ Ext.define('Docs.view.comments.List', { this.delegateClick("a.undoDeleteComment", function(el, r) { this.setDeleted(el, r, false); }, this); this.delegateClick("a.readComment", function(el, r) { this.markRead(el, r); }, this); this.delegateClick("a.readComment", this.markRead, this); this.delegateClick("a.add-tag", this.addTag, this); this.delegateClick("a.remove-tag", this.removeTag, this); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -129,6 +132,15 @@ Ext.define('Docs.view.comments.List', { comment.markRead(); }, addTag: function(el, comment) { // TODO... }, removeTag: function(el, comment) { var tagname = Ext.get(el).up(".tag").down("b").getHTML(); comment.removeTag(tagname); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading
template/app/view/comments/Template.js +2 −2 Original line number Diff line number Diff line Loading @@ -53,8 +53,8 @@ Ext.define('Docs.view.comments.Template', { '<div class="top-right">', '<tpl for="tags">', '<span href="#" class="tag">', '{.}', '<tpl if="this.isMod()"><a href="#" class="delete" title="Delete tag">–</a></tpl>', '<b>{.}</b>', '<tpl if="this.isMod()"><a href="#" class="remove-tag" title="Delete tag">–</a></tpl>', '</span>', '</tpl>', '<tpl if="this.isMod()">', Loading