Loading template/app/controller/Comments.js +14 −2 Original line number Diff line number Diff line Loading @@ -64,6 +64,13 @@ Ext.define('Docs.controller.Comments', { scope: this }); this.getController('Guides').on({ showGuide: function(guide) { this.renderGuideCommentContainers(guide); }, scope: this }); this.control({ 'viewport': { afterrender: function(cmp) { Loading Loading @@ -106,9 +113,7 @@ Ext.define('Docs.controller.Comments', { enableComments: function() { if (!this.commentsEnabled) { // alert(this.getController('Classes').currentCls) this.commentsEnabled = true; // Docs.view.Comments.renderClassCommentContainers(this.getController('Classes').currentCls); } }, Loading Loading @@ -488,6 +493,13 @@ Ext.define('Docs.controller.Comments', { Docs.view.Comments.renderClassCommentContainers(cls); }, renderGuideCommentContainers: function(guide) { Docs.view.Comments.classCommentsTpl.append(Ext.get('guide'), { num: 0, id: 'guide-' + guide }); }, renderComments: function(rows, id, opts) { opts = opts || {}; Loading template/app/controller/CommentsMeta.js +30 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,8 @@ Ext.define('Docs.controller.CommentsMeta', { init: function() { Docs.commentMeta = { idMap: {}, 'class': {} 'class': {}, guide: {} }; this.addEvents( Loading @@ -42,10 +43,10 @@ Ext.define('Docs.controller.CommentsMeta', { this.getController('Comments').on({ add: function(id) { this.updateClassCommentMeta(id, 1); this.updateCommentMeta(id, 1); }, remove: function(id) { this.updateClassCommentMeta(id, -1); this.updateCommentMeta(id, -1); }, scope: this }); Loading @@ -63,6 +64,14 @@ Ext.define('Docs.controller.CommentsMeta', { scope: this }); this.getController('Guides').on({ showGuide: function(guide, opts) { Docs.commentMeta.idMap['comments-guide-' + guide] = ['guide', guide, '']; this.renderGuideCommentMeta(guide); }, scope: this }); this.control({ 'hovermenu': { refresh : this.refreshHoverMenu Loading Loading @@ -148,10 +157,14 @@ Ext.define('Docs.controller.CommentsMeta', { /** * Called when a comment is added or removed. Updates the meta table, then refreshes the view */ updateClassCommentMeta: function(id, delta) { updateCommentMeta: function(id, delta) { var clsId = Docs.commentMeta.idMap[id]; this.updateMeta(clsId, delta); if (clsId[0] == 'guide') { Docs.view.Comments.updateGuideCommentMeta(clsId[1]); } else { Docs.view.Comments.updateClassCommentMeta(clsId[1]); } }, /** Loading Loading @@ -222,5 +235,17 @@ Ext.define('Docs.controller.CommentsMeta', { single: true }); } }, renderGuideCommentMeta: function(cls) { if (this.metaLoaded) { Docs.view.Comments.updateGuideCommentMeta(cls); } else { this.addListener('afterLoad', function() { Docs.view.Comments.updateGuideCommentMeta(cls); }, this, { single: true }); } } }); template/app/view/Comments.js +20 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,26 @@ Ext.define('Docs.view.Comments', { }); }, /** * Updates the comment meta information (i.e. number of comments) on a class page */ updateGuideCommentMeta: function(guide) { var guideMeta = Docs.commentMeta['guide'][guide]; if (guideMeta && guideMeta['']) { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: guideMeta[''] }); } else { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: 0 }); } }, renderHoverMenuMeta: function(cmp) { Ext.Array.each(cmp.query('a.docClass'), function(a) { var rel = "comments-class-" + a.getAttribute('rel').replace(/[^A-Za-z\-]/g, '-'), Loading template/resources/sass/_comments.scss +5 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,11 @@ font-weight: bold; cursor: pointer; } #center-container .guide-container h3.members-title.icon-comment { padding: 0 0 5px 25px; margin: 30px 0 5px 0; background: url(../images/comment-bubble.png) no-repeat 1px -26px; } .comments-section { .comments { @include member-expander; } } Loading Loading
template/app/controller/Comments.js +14 −2 Original line number Diff line number Diff line Loading @@ -64,6 +64,13 @@ Ext.define('Docs.controller.Comments', { scope: this }); this.getController('Guides').on({ showGuide: function(guide) { this.renderGuideCommentContainers(guide); }, scope: this }); this.control({ 'viewport': { afterrender: function(cmp) { Loading Loading @@ -106,9 +113,7 @@ Ext.define('Docs.controller.Comments', { enableComments: function() { if (!this.commentsEnabled) { // alert(this.getController('Classes').currentCls) this.commentsEnabled = true; // Docs.view.Comments.renderClassCommentContainers(this.getController('Classes').currentCls); } }, Loading Loading @@ -488,6 +493,13 @@ Ext.define('Docs.controller.Comments', { Docs.view.Comments.renderClassCommentContainers(cls); }, renderGuideCommentContainers: function(guide) { Docs.view.Comments.classCommentsTpl.append(Ext.get('guide'), { num: 0, id: 'guide-' + guide }); }, renderComments: function(rows, id, opts) { opts = opts || {}; Loading
template/app/controller/CommentsMeta.js +30 −5 Original line number Diff line number Diff line Loading @@ -23,7 +23,8 @@ Ext.define('Docs.controller.CommentsMeta', { init: function() { Docs.commentMeta = { idMap: {}, 'class': {} 'class': {}, guide: {} }; this.addEvents( Loading @@ -42,10 +43,10 @@ Ext.define('Docs.controller.CommentsMeta', { this.getController('Comments').on({ add: function(id) { this.updateClassCommentMeta(id, 1); this.updateCommentMeta(id, 1); }, remove: function(id) { this.updateClassCommentMeta(id, -1); this.updateCommentMeta(id, -1); }, scope: this }); Loading @@ -63,6 +64,14 @@ Ext.define('Docs.controller.CommentsMeta', { scope: this }); this.getController('Guides').on({ showGuide: function(guide, opts) { Docs.commentMeta.idMap['comments-guide-' + guide] = ['guide', guide, '']; this.renderGuideCommentMeta(guide); }, scope: this }); this.control({ 'hovermenu': { refresh : this.refreshHoverMenu Loading Loading @@ -148,10 +157,14 @@ Ext.define('Docs.controller.CommentsMeta', { /** * Called when a comment is added or removed. Updates the meta table, then refreshes the view */ updateClassCommentMeta: function(id, delta) { updateCommentMeta: function(id, delta) { var clsId = Docs.commentMeta.idMap[id]; this.updateMeta(clsId, delta); if (clsId[0] == 'guide') { Docs.view.Comments.updateGuideCommentMeta(clsId[1]); } else { Docs.view.Comments.updateClassCommentMeta(clsId[1]); } }, /** Loading Loading @@ -222,5 +235,17 @@ Ext.define('Docs.controller.CommentsMeta', { single: true }); } }, renderGuideCommentMeta: function(cls) { if (this.metaLoaded) { Docs.view.Comments.updateGuideCommentMeta(cls); } else { this.addListener('afterLoad', function() { Docs.view.Comments.updateGuideCommentMeta(cls); }, this, { single: true }); } } });
template/app/view/Comments.js +20 −0 Original line number Diff line number Diff line Loading @@ -376,6 +376,26 @@ Ext.define('Docs.view.Comments', { }); }, /** * Updates the comment meta information (i.e. number of comments) on a class page */ updateGuideCommentMeta: function(guide) { var guideMeta = Docs.commentMeta['guide'][guide]; if (guideMeta && guideMeta['']) { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: guideMeta[''] }); } else { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: 0 }); } }, renderHoverMenuMeta: function(cmp) { Ext.Array.each(cmp.query('a.docClass'), function(a) { var rel = "comments-class-" + a.getAttribute('rel').replace(/[^A-Za-z\-]/g, '-'), Loading
template/resources/sass/_comments.scss +5 −0 Original line number Diff line number Diff line Loading @@ -11,6 +11,11 @@ font-weight: bold; cursor: pointer; } #center-container .guide-container h3.members-title.icon-comment { padding: 0 0 5px 25px; margin: 30px 0 5px 0; background: url(../images/comment-bubble.png) no-repeat 1px -26px; } .comments-section { .comments { @include member-expander; } } Loading