Loading template/app/Comments.js +10 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,16 @@ Ext.define('Docs.Comments', { avatar: function(emailHash) { return '<img class="avatar" width="25" height="25" src="http://www.gravatar.com/avatar/' + emailHash + '?s=25&r=PG&d=monsterid">'; }, /** * Returns HTML for rendering the span with comments count. * Defined here so we can uniformly use the same HTML everywhere. * @param {Number} count * @return {String} */ counterHtml: function(count) { return count > 0 ? '<span class="comment-counter-small">'+count+'</span>' : ''; } }); template/app/view/HoverMenu.js +4 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,9 @@ */ Ext.define('Docs.view.HoverMenu', { extend: 'Ext.view.View', requires: [ 'Docs.Comments' ], alias: 'widget.hovermenu', componentCls: 'hover-menu', Loading Loading @@ -42,7 +45,7 @@ Ext.define('Docs.view.HoverMenu', { return values.meta[s.key] ? '<span class="signature '+s.key+'">'+(s["short"])+'</span>' : ''; }).join(' '); var cnt = values.commentCount > 0 ? '<span class="toggleMemberComments">'+values.commentCount+'</span>' : ''; var cnt = Docs.Comments.counterHtml(values.commentCount); return Ext.String.format('<a href="#!/api/{0}" rel="{0}" class="docClass">{1} {2} {3}</a>', values.url, values.label, tags, cnt); } Loading template/app/view/ThumbList.js +1 −5 Original line number Diff line number Diff line Loading @@ -83,10 +83,6 @@ Ext.define('Docs.view.ThumbList', { this.itemTpl = undefined; this.data = undefined; this.commentCountTpl = Ext.create('Ext.Template', '<span class="toggleMemberComments">{0}</span>' ); // Listen to viewready because the whole HTML is not yet // rendered when afterrender fires - and initComments relies // on the view being rendered fully. Loading Loading @@ -119,7 +115,7 @@ Ext.define('Docs.view.ThumbList', { var name = dd.getAttributeNS("ext", this.urlField).replace(/^.*\//, ""); var count = Docs.Comments.getCount(this.commentType, name); if (count) { this.commentCountTpl.append(dd.down("p"), [count]); Ext.DomHelper.append(dd.down("p"), Docs.Comments.counterHtml(count)); } }, this); }, Loading template/app/view/cls/Index.js +1 −5 Original line number Diff line number Diff line Loading @@ -26,10 +26,6 @@ Ext.define('Docs.view.cls.Index', { categories: Docs.ContentGrabber.get("categories-content") }; this.commentCountTpl = Ext.create('Ext.Template', '<span class="toggleMemberComments">{0}</span>' ); this.callParent(arguments); }, Loading @@ -44,7 +40,7 @@ Ext.define('Docs.view.cls.Index', { var className = a.getHTML(); var count = Docs.Comments.getClassTotalCount(className); if (count) { this.commentCountTpl.append(a, [count]); Ext.DomHelper.append(a, Docs.Comments.counterHtml(count)); } }, this); }, Loading template/app/view/comments/MemberWrap.js +2 −4 Original line number Diff line number Diff line Loading @@ -8,8 +8,6 @@ Ext.define('Docs.view.comments.MemberWrap', { "Docs.view.comments.Expander" ], tpl: Ext.create("Ext.XTemplate", '<span class="toggleMemberComments">{0}</span>'), /** * @cfg {Docs.view.cls.Overview} parent * The parent class Overview component. Loading Loading @@ -55,14 +53,14 @@ Ext.define('Docs.view.comments.MemberWrap', { updateCountInTitle: function(count) { var titleEl = this.el.down(".title"); var titleComments = titleEl.down('.toggleMemberComments'); var titleComments = titleEl.down('.comment-counter-small'); if (count > 0) { if (titleComments) { titleComments.update(""+count); } else { var el = this.tpl.append(titleEl, [count], true); var el = Ext.DomHelper.append(titleEl, Docs.Comments.counterHtml(count), true); el.on("click", function() { this.el.addCls("open"); this.expander.expand(); Loading Loading
template/app/Comments.js +10 −0 Original line number Diff line number Diff line Loading @@ -158,6 +158,16 @@ Ext.define('Docs.Comments', { avatar: function(emailHash) { return '<img class="avatar" width="25" height="25" src="http://www.gravatar.com/avatar/' + emailHash + '?s=25&r=PG&d=monsterid">'; }, /** * Returns HTML for rendering the span with comments count. * Defined here so we can uniformly use the same HTML everywhere. * @param {Number} count * @return {String} */ counterHtml: function(count) { return count > 0 ? '<span class="comment-counter-small">'+count+'</span>' : ''; } });
template/app/view/HoverMenu.js +4 −1 Original line number Diff line number Diff line Loading @@ -3,6 +3,9 @@ */ Ext.define('Docs.view.HoverMenu', { extend: 'Ext.view.View', requires: [ 'Docs.Comments' ], alias: 'widget.hovermenu', componentCls: 'hover-menu', Loading Loading @@ -42,7 +45,7 @@ Ext.define('Docs.view.HoverMenu', { return values.meta[s.key] ? '<span class="signature '+s.key+'">'+(s["short"])+'</span>' : ''; }).join(' '); var cnt = values.commentCount > 0 ? '<span class="toggleMemberComments">'+values.commentCount+'</span>' : ''; var cnt = Docs.Comments.counterHtml(values.commentCount); return Ext.String.format('<a href="#!/api/{0}" rel="{0}" class="docClass">{1} {2} {3}</a>', values.url, values.label, tags, cnt); } Loading
template/app/view/ThumbList.js +1 −5 Original line number Diff line number Diff line Loading @@ -83,10 +83,6 @@ Ext.define('Docs.view.ThumbList', { this.itemTpl = undefined; this.data = undefined; this.commentCountTpl = Ext.create('Ext.Template', '<span class="toggleMemberComments">{0}</span>' ); // Listen to viewready because the whole HTML is not yet // rendered when afterrender fires - and initComments relies // on the view being rendered fully. Loading Loading @@ -119,7 +115,7 @@ Ext.define('Docs.view.ThumbList', { var name = dd.getAttributeNS("ext", this.urlField).replace(/^.*\//, ""); var count = Docs.Comments.getCount(this.commentType, name); if (count) { this.commentCountTpl.append(dd.down("p"), [count]); Ext.DomHelper.append(dd.down("p"), Docs.Comments.counterHtml(count)); } }, this); }, Loading
template/app/view/cls/Index.js +1 −5 Original line number Diff line number Diff line Loading @@ -26,10 +26,6 @@ Ext.define('Docs.view.cls.Index', { categories: Docs.ContentGrabber.get("categories-content") }; this.commentCountTpl = Ext.create('Ext.Template', '<span class="toggleMemberComments">{0}</span>' ); this.callParent(arguments); }, Loading @@ -44,7 +40,7 @@ Ext.define('Docs.view.cls.Index', { var className = a.getHTML(); var count = Docs.Comments.getClassTotalCount(className); if (count) { this.commentCountTpl.append(a, [count]); Ext.DomHelper.append(a, Docs.Comments.counterHtml(count)); } }, this); }, Loading
template/app/view/comments/MemberWrap.js +2 −4 Original line number Diff line number Diff line Loading @@ -8,8 +8,6 @@ Ext.define('Docs.view.comments.MemberWrap', { "Docs.view.comments.Expander" ], tpl: Ext.create("Ext.XTemplate", '<span class="toggleMemberComments">{0}</span>'), /** * @cfg {Docs.view.cls.Overview} parent * The parent class Overview component. Loading Loading @@ -55,14 +53,14 @@ Ext.define('Docs.view.comments.MemberWrap', { updateCountInTitle: function(count) { var titleEl = this.el.down(".title"); var titleComments = titleEl.down('.toggleMemberComments'); var titleComments = titleEl.down('.comment-counter-small'); if (count > 0) { if (titleComments) { titleComments.update(""+count); } else { var el = this.tpl.append(titleEl, [count], true); var el = Ext.DomHelper.append(titleEl, Docs.Comments.counterHtml(count), true); el.on("click", function() { this.el.addCls("open"); this.expander.expand(); Loading