Loading template/app/view/comments/Form.js +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ Ext.define('Docs.view.comments.Form', { */ constructor: function(cfg) { Ext.apply(this, cfg); this.updateComment = (this.content !== undefined); var innerTpl = [ '<div class="com-meta">', Loading Loading @@ -139,7 +140,7 @@ Ext.define('Docs.view.comments.Form', { render: function() { var wrap = this.tpl.overwrite(this.renderTo, { definedIn: this.updateComment ? undefined : this.extractDefinedIn(this.renderTo), updateComment: this.content !== undefined, updateComment: this.updateComment, content: this.content, userSubscribed: this.userSubscribed, user: this.user Loading template/app/view/comments/List.js +30 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Ext.define('Docs.view.comments.List', { 'Docs.Syntax', 'Docs.Comments', 'Docs.view.comments.Template', 'Docs.view.comments.Form', 'Docs.Tip' ], Loading Loading @@ -59,6 +60,9 @@ 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); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -98,6 +102,32 @@ Ext.define('Docs.view.comments.List', { }); }, // starts an editor on the comment edit: function(el, comment) { this.loadOrigContent(comment, function(content) { var contentEl = Ext.get(el).up(".comment").down(".content"); new Docs.view.comments.Form({ renderTo: contentEl, user: Docs.Auth.getUser(), content: content }); }, this); }, loadOrigContent: function(comment, callback, scope) { Docs.Comments.request("ajax", { url: '/comments/' + comment.get("_id"), method: 'GET', callback: function(options, success, response) { var data = Ext.JSON.decode(response.responseText); if (data.success) { callback.call(scope, data.content); } }, scope: this }); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading Loading
template/app/view/comments/Form.js +2 −1 Original line number Diff line number Diff line Loading @@ -27,6 +27,7 @@ Ext.define('Docs.view.comments.Form', { */ constructor: function(cfg) { Ext.apply(this, cfg); this.updateComment = (this.content !== undefined); var innerTpl = [ '<div class="com-meta">', Loading Loading @@ -139,7 +140,7 @@ Ext.define('Docs.view.comments.Form', { render: function() { var wrap = this.tpl.overwrite(this.renderTo, { definedIn: this.updateComment ? undefined : this.extractDefinedIn(this.renderTo), updateComment: this.content !== undefined, updateComment: this.updateComment, content: this.content, userSubscribed: this.userSubscribed, user: this.user Loading
template/app/view/comments/List.js +30 −0 Original line number Diff line number Diff line Loading @@ -9,6 +9,7 @@ Ext.define('Docs.view.comments.List', { 'Docs.Syntax', 'Docs.Comments', 'Docs.view.comments.Template', 'Docs.view.comments.Form', 'Docs.Tip' ], Loading Loading @@ -59,6 +60,9 @@ 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); }, delegateClick: function(selector, callback, scope) { Loading Loading @@ -98,6 +102,32 @@ Ext.define('Docs.view.comments.List', { }); }, // starts an editor on the comment edit: function(el, comment) { this.loadOrigContent(comment, function(content) { var contentEl = Ext.get(el).up(".comment").down(".content"); new Docs.view.comments.Form({ renderTo: contentEl, user: Docs.Auth.getUser(), content: content }); }, this); }, loadOrigContent: function(comment, callback, scope) { Docs.Comments.request("ajax", { url: '/comments/' + comment.get("_id"), method: 'GET', callback: function(options, success, response) { var data = Ext.JSON.decode(response.responseText); if (data.success) { callback.call(scope, data.content); } }, scope: this }); }, /** * Loads array of comments into the view. * @param {Object[]} comments Loading