Loading template/app/controller/Comments.js +0 −3 Original line number Diff line number Diff line Loading @@ -703,11 +703,8 @@ Ext.define('Docs.controller.Comments', { var commentWrap = comments.down('.new-comment-wrap'); if (this.isLoggedIn()) { var memInfo = Docs.view.Comments.extractMemberInfo(commentWrap); new Docs.view.comments.Form({ renderTo: commentWrap, definedIn: memInfo.definedIn, user: this.getController('Auth').currentUser, userSubscribed: Docs.commentSubscriptions[id] }); Loading template/app/view/Comments.js +0 −18 Original line number Diff line number Diff line Loading @@ -353,14 +353,12 @@ Ext.define('Docs.view.Comments', { Ext.Array.each(Ext.query('.new-comment-wrap'), function(newComment) { var hideCommentForm = Ext.get(newComment).up('.comment-list').parent().hasCls('hideCommentForm'); var memInfo = this.extractMemberInfo(newComment); if (hideCommentForm) { // Do nothing } else if (Docs.App.getController('Auth').isLoggedIn()) { new Docs.view.comments.Form({ renderTo: newComment, definedIn: memInfo.definedIn, user: currentUser }); } else { Loading @@ -369,22 +367,6 @@ Ext.define('Docs.view.Comments', { }, this); }, /** * Given an HTML element, determines the member it's in and if the * member is inherited. If it's inherited, returns hash with * `{definedIn: "className"}`. Otherwise just returns empty hash. * The definedIn value is used inside template to print a notice * about posting a possible out-of-context comment. */ extractMemberInfo: function(el) { var info = {}; var member = Ext.get(el).up(".member"); if (member && member.hasCls("inherited")) { info.definedIn = member.down(".defined-in").getHTML(); } return info; }, showMember: function(cls, member) { var memberEl = Ext.get(member).down('.long'), id = ('class-' + cls + '-' + member).replace(/\./g, '-'); Loading template/app/view/comments/Form.js +14 −7 Original line number Diff line number Diff line Loading @@ -10,12 +10,6 @@ Ext.define('Docs.view.comments.Form', { * @cfg {Object} user * Object describing currently logged in user. */ /** * @cfg {String} definedIn * The name of the class the member which we're commenting is * defined in. Should only be supplied when editing a member * belonging to parent class. */ /** * @cfg {Boolean} userSubscribed * True when user is subscribed to this thread. Loading Loading @@ -147,7 +141,7 @@ Ext.define('Docs.view.comments.Form', { render: function() { var cfg = Ext.apply({ definedIn: this.definedIn, definedIn: this.updateComment ? undefined : this.extractDefinedIn(this.renderTo), updateComment: this.updateComment, content: this.content, userSubscribed: this.userSubscribed Loading @@ -157,6 +151,19 @@ Ext.define('Docs.view.comments.Form', { this.makeCodeMirror(wrap.down('textarea').dom); }, // Given an HTML element, determines the member it's in and if the // member is inherited. If it's inherited, returns a string // with the classname. Otherwise just returns undefined. // The definedIn value is used inside template to print a notice // about posting a possible out-of-context comment. extractDefinedIn: function(el) { var member = Ext.get(el).up(".member"); if (member && member.hasCls("inherited")) { return member.down(".defined-in").getHTML(); } return undefined; }, makeCodeMirror: function(textarea) { textarea.editor = CodeMirror.fromTextArea(textarea, { mode: 'markdown', Loading Loading
template/app/controller/Comments.js +0 −3 Original line number Diff line number Diff line Loading @@ -703,11 +703,8 @@ Ext.define('Docs.controller.Comments', { var commentWrap = comments.down('.new-comment-wrap'); if (this.isLoggedIn()) { var memInfo = Docs.view.Comments.extractMemberInfo(commentWrap); new Docs.view.comments.Form({ renderTo: commentWrap, definedIn: memInfo.definedIn, user: this.getController('Auth').currentUser, userSubscribed: Docs.commentSubscriptions[id] }); Loading
template/app/view/Comments.js +0 −18 Original line number Diff line number Diff line Loading @@ -353,14 +353,12 @@ Ext.define('Docs.view.Comments', { Ext.Array.each(Ext.query('.new-comment-wrap'), function(newComment) { var hideCommentForm = Ext.get(newComment).up('.comment-list').parent().hasCls('hideCommentForm'); var memInfo = this.extractMemberInfo(newComment); if (hideCommentForm) { // Do nothing } else if (Docs.App.getController('Auth').isLoggedIn()) { new Docs.view.comments.Form({ renderTo: newComment, definedIn: memInfo.definedIn, user: currentUser }); } else { Loading @@ -369,22 +367,6 @@ Ext.define('Docs.view.Comments', { }, this); }, /** * Given an HTML element, determines the member it's in and if the * member is inherited. If it's inherited, returns hash with * `{definedIn: "className"}`. Otherwise just returns empty hash. * The definedIn value is used inside template to print a notice * about posting a possible out-of-context comment. */ extractMemberInfo: function(el) { var info = {}; var member = Ext.get(el).up(".member"); if (member && member.hasCls("inherited")) { info.definedIn = member.down(".defined-in").getHTML(); } return info; }, showMember: function(cls, member) { var memberEl = Ext.get(member).down('.long'), id = ('class-' + cls + '-' + member).replace(/\./g, '-'); Loading
template/app/view/comments/Form.js +14 −7 Original line number Diff line number Diff line Loading @@ -10,12 +10,6 @@ Ext.define('Docs.view.comments.Form', { * @cfg {Object} user * Object describing currently logged in user. */ /** * @cfg {String} definedIn * The name of the class the member which we're commenting is * defined in. Should only be supplied when editing a member * belonging to parent class. */ /** * @cfg {Boolean} userSubscribed * True when user is subscribed to this thread. Loading Loading @@ -147,7 +141,7 @@ Ext.define('Docs.view.comments.Form', { render: function() { var cfg = Ext.apply({ definedIn: this.definedIn, definedIn: this.updateComment ? undefined : this.extractDefinedIn(this.renderTo), updateComment: this.updateComment, content: this.content, userSubscribed: this.userSubscribed Loading @@ -157,6 +151,19 @@ Ext.define('Docs.view.comments.Form', { this.makeCodeMirror(wrap.down('textarea').dom); }, // Given an HTML element, determines the member it's in and if the // member is inherited. If it's inherited, returns a string // with the classname. Otherwise just returns undefined. // The definedIn value is used inside template to print a notice // about posting a possible out-of-context comment. extractDefinedIn: function(el) { var member = Ext.get(el).up(".member"); if (member && member.hasCls("inherited")) { return member.down(".defined-in").getHTML(); } return undefined; }, makeCodeMirror: function(textarea) { textarea.editor = CodeMirror.fromTextArea(textarea, { mode: 'markdown', Loading