Loading template/app/Comments.js +26 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,32 @@ Ext.define('Docs.Comments', { }); }, /** * Marks the comment as deleted or undoes the delete. * @param {Object} cfg * @param {Docs.model.Comment} cfg.comment * @param {Boolean} cfg.deleted True to delete, false to undo. * @param {Function} cfg.success * @param {Function} cfg.failure * @param {Object} cfg.scope */ markRead: function(cfg) { Docs.Comments.request("ajax", { url: '/comments/' + cfg.comment.get("id") + '/read', method: 'POST', callback: function(options, success, response) { var data = Ext.JSON.decode(response.responseText); if (success && data.success) { cfg.success && cfg.success.call(cfg.scope); } else { cfg.failure && cfg.failure.call(cfg.scope, data.reason); } }, scope: this }); }, /** * Performs request to the comments server. * Loading template/app/model/Comment.js +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ Ext.define('Docs.model.Comment', { "upVote", "downVote", "contentHtml", "read", "deleted" ], proxy: { Loading template/app/view/comments/List.js +13 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,9 @@ 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); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -155,6 +158,16 @@ Ext.define('Docs.view.comments.List', { }); }, markRead: function(el, comment) { Docs.Comments.markRead({ comment: comment, success: function() { comment.set("read", true); comment.commit(); } }); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading Loading
template/app/Comments.js +26 −0 Original line number Diff line number Diff line Loading @@ -185,6 +185,32 @@ Ext.define('Docs.Comments', { }); }, /** * Marks the comment as deleted or undoes the delete. * @param {Object} cfg * @param {Docs.model.Comment} cfg.comment * @param {Boolean} cfg.deleted True to delete, false to undo. * @param {Function} cfg.success * @param {Function} cfg.failure * @param {Object} cfg.scope */ markRead: function(cfg) { Docs.Comments.request("ajax", { url: '/comments/' + cfg.comment.get("id") + '/read', method: 'POST', callback: function(options, success, response) { var data = Ext.JSON.decode(response.responseText); if (success && data.success) { cfg.success && cfg.success.call(cfg.scope); } else { cfg.failure && cfg.failure.call(cfg.scope, data.reason); } }, scope: this }); }, /** * Performs request to the comments server. * Loading
template/app/model/Comment.js +1 −0 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ Ext.define('Docs.model.Comment', { "upVote", "downVote", "contentHtml", "read", "deleted" ], proxy: { Loading
template/app/view/comments/List.js +13 −0 Original line number Diff line number Diff line Loading @@ -63,6 +63,9 @@ 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); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -155,6 +158,16 @@ Ext.define('Docs.view.comments.List', { }); }, markRead: function(el, comment) { Docs.Comments.markRead({ comment: comment, success: function() { comment.set("read", true); comment.commit(); } }); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading