Loading template/app/controller/Comments.js +16 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,15 @@ Ext.define('Docs.controller.Comments', { scope: this }); this.getController('Videos').on({ showVideo: function(video, opts) { if (opts.reRendered) { this.renderVideoCommentContainers(video); } }, scope: this }); this.control({ 'viewport': { afterrender: function(cmp) { Loading Loading @@ -502,6 +511,13 @@ Ext.define('Docs.controller.Comments', { }); }, renderVideoCommentContainers: function(video) { Docs.view.Comments.classCommentsTpl.append(Ext.get('video'), { num: 0, id: 'video-' + video }); }, renderComments: function(rows, id, opts) { opts = opts || {}; Loading template/app/controller/CommentsMeta.js +24 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ Ext.define('Docs.controller.CommentsMeta', { Docs.commentMeta = { idMap: {}, 'class': {}, guide: {} guide: {}, video: {} }; this.addEvents( Loading Loading @@ -72,6 +73,14 @@ Ext.define('Docs.controller.CommentsMeta', { scope: this }); this.getController('Videos').on({ showVideo: function(video, opts) { Docs.commentMeta.idMap['comments-video-' + video] = ['video', video, '']; this.renderVideoCommentMeta(video); }, scope: this }); this.control({ 'hovermenu': { refresh : this.refreshHoverMenu Loading Loading @@ -162,6 +171,8 @@ Ext.define('Docs.controller.CommentsMeta', { this.updateMeta(clsId, delta); if (clsId[0] == 'guide') { Docs.view.Comments.updateGuideCommentMeta(clsId[1]); } else if (clsId[0] == 'video') { Docs.view.Comments.updateVideoCommentMeta(clsId[1]); } else { Docs.view.Comments.updateClassCommentMeta(clsId[1]); } Loading Loading @@ -247,5 +258,17 @@ Ext.define('Docs.controller.CommentsMeta', { single: true }); } }, renderVideoCommentMeta: function(cls) { if (this.metaLoaded) { Docs.view.Comments.updateVideoCommentMeta(cls); } else { this.addListener('afterLoad', function() { Docs.view.Comments.updateVideoCommentMeta(cls); }, this, { single: true }); } } }); template/app/controller/Tabs.js +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ Ext.define('Docs.controller.Tabs', { this.getController('Videos').addListener({ showVideo: function(video) { this.addTabFromTree(video); this.addTabFromTree("#!/video/"+video); }, scope: this }); Loading template/app/controller/Videos.js +6 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ Ext.define('Docs.controller.Videos', { /** * @event showVideo * Fired after a video is shown. Used for analytics event tracking. * @param {String} video name of the video. * @param {Number} video ID of the video. */ "showVideo" ); Loading @@ -51,6 +51,9 @@ Ext.define('Docs.controller.Videos', { }, loadVideo: function(url, noHistory) { var reRendered = false; Ext.getCmp('card-panel').layout.setActiveItem('video'); Ext.getCmp('treecontainer').showTree('videotree'); var videoId = url.match(/[0-9]+$/)[0]; Loading @@ -59,9 +62,10 @@ Ext.define('Docs.controller.Videos', { this.getViewport().setPageTitle(video.title); if (this.activeUrl !== url) { Ext.getCmp('video').load(video); reRendered = true; } noHistory || Docs.History.push(url); this.fireEvent('showVideo', url); this.fireEvent('showVideo', videoId, {reRendered: reRendered}); this.getTree().selectUrl(url); this.activeUrl = url; }, Loading template/app/view/Comments.js +22 −17 Original line number Diff line number Diff line Loading @@ -109,12 +109,21 @@ Ext.define('Docs.view.Comments', { }, target: function(target) { var url = target[1], title = target[1]; if (target[2] != '') { title = target[1], urlPrefix = '#!/api/'; if (target[0] == 'video') { title = 'Video ' + title; urlPrefix = '#!/video/'; } else if (target[0] == 'guide') { title = 'Guide ' + title; urlPrefix = '#!/guide/'; } else if (target[2] != '') { url += '-' + target[2]; title += ' ' + target[2]; } return '<a href="#!/api/' + url + '" class="docClass" rel="' + url + '">' + title + '</a>'; return '<a href="' + urlPrefix + url + '">' + title + '</a>'; }, moreComments: function(values) { var values = values[values.length - 1]; Loading Loading @@ -376,24 +385,20 @@ 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[''] num: guideMeta && guideMeta[''] ? guideMeta[''] : 0 }); } else { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: 0 }, updateVideoCommentMeta: function(video) { var videoMeta = Docs.commentMeta['video'][video]; this.numCommentsTpl.overwrite(Ext.get(Ext.query('#video .comments-section a.name')[0]), { num: videoMeta && videoMeta[''] ? videoMeta[''] : 0 }); } }, renderHoverMenuMeta: function(cmp) { Loading Loading
template/app/controller/Comments.js +16 −0 Original line number Diff line number Diff line Loading @@ -73,6 +73,15 @@ Ext.define('Docs.controller.Comments', { scope: this }); this.getController('Videos').on({ showVideo: function(video, opts) { if (opts.reRendered) { this.renderVideoCommentContainers(video); } }, scope: this }); this.control({ 'viewport': { afterrender: function(cmp) { Loading Loading @@ -502,6 +511,13 @@ Ext.define('Docs.controller.Comments', { }); }, renderVideoCommentContainers: function(video) { Docs.view.Comments.classCommentsTpl.append(Ext.get('video'), { num: 0, id: 'video-' + video }); }, renderComments: function(rows, id, opts) { opts = opts || {}; Loading
template/app/controller/CommentsMeta.js +24 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,8 @@ Ext.define('Docs.controller.CommentsMeta', { Docs.commentMeta = { idMap: {}, 'class': {}, guide: {} guide: {}, video: {} }; this.addEvents( Loading Loading @@ -72,6 +73,14 @@ Ext.define('Docs.controller.CommentsMeta', { scope: this }); this.getController('Videos').on({ showVideo: function(video, opts) { Docs.commentMeta.idMap['comments-video-' + video] = ['video', video, '']; this.renderVideoCommentMeta(video); }, scope: this }); this.control({ 'hovermenu': { refresh : this.refreshHoverMenu Loading Loading @@ -162,6 +171,8 @@ Ext.define('Docs.controller.CommentsMeta', { this.updateMeta(clsId, delta); if (clsId[0] == 'guide') { Docs.view.Comments.updateGuideCommentMeta(clsId[1]); } else if (clsId[0] == 'video') { Docs.view.Comments.updateVideoCommentMeta(clsId[1]); } else { Docs.view.Comments.updateClassCommentMeta(clsId[1]); } Loading Loading @@ -247,5 +258,17 @@ Ext.define('Docs.controller.CommentsMeta', { single: true }); } }, renderVideoCommentMeta: function(cls) { if (this.metaLoaded) { Docs.view.Comments.updateVideoCommentMeta(cls); } else { this.addListener('afterLoad', function() { Docs.view.Comments.updateVideoCommentMeta(cls); }, this, { single: true }); } } });
template/app/controller/Tabs.js +1 −1 Original line number Diff line number Diff line Loading @@ -77,7 +77,7 @@ Ext.define('Docs.controller.Tabs', { this.getController('Videos').addListener({ showVideo: function(video) { this.addTabFromTree(video); this.addTabFromTree("#!/video/"+video); }, scope: this }); Loading
template/app/controller/Videos.js +6 −2 Original line number Diff line number Diff line Loading @@ -26,7 +26,7 @@ Ext.define('Docs.controller.Videos', { /** * @event showVideo * Fired after a video is shown. Used for analytics event tracking. * @param {String} video name of the video. * @param {Number} video ID of the video. */ "showVideo" ); Loading @@ -51,6 +51,9 @@ Ext.define('Docs.controller.Videos', { }, loadVideo: function(url, noHistory) { var reRendered = false; Ext.getCmp('card-panel').layout.setActiveItem('video'); Ext.getCmp('treecontainer').showTree('videotree'); var videoId = url.match(/[0-9]+$/)[0]; Loading @@ -59,9 +62,10 @@ Ext.define('Docs.controller.Videos', { this.getViewport().setPageTitle(video.title); if (this.activeUrl !== url) { Ext.getCmp('video').load(video); reRendered = true; } noHistory || Docs.History.push(url); this.fireEvent('showVideo', url); this.fireEvent('showVideo', videoId, {reRendered: reRendered}); this.getTree().selectUrl(url); this.activeUrl = url; }, Loading
template/app/view/Comments.js +22 −17 Original line number Diff line number Diff line Loading @@ -109,12 +109,21 @@ Ext.define('Docs.view.Comments', { }, target: function(target) { var url = target[1], title = target[1]; if (target[2] != '') { title = target[1], urlPrefix = '#!/api/'; if (target[0] == 'video') { title = 'Video ' + title; urlPrefix = '#!/video/'; } else if (target[0] == 'guide') { title = 'Guide ' + title; urlPrefix = '#!/guide/'; } else if (target[2] != '') { url += '-' + target[2]; title += ' ' + target[2]; } return '<a href="#!/api/' + url + '" class="docClass" rel="' + url + '">' + title + '</a>'; return '<a href="' + urlPrefix + url + '">' + title + '</a>'; }, moreComments: function(values) { var values = values[values.length - 1]; Loading Loading @@ -376,24 +385,20 @@ 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[''] num: guideMeta && guideMeta[''] ? guideMeta[''] : 0 }); } else { // Update class level comments meta this.numCommentsTpl.overwrite(Ext.get(Ext.query('#guide .comments-section a.name')[0]), { num: 0 }, updateVideoCommentMeta: function(video) { var videoMeta = Docs.commentMeta['video'][video]; this.numCommentsTpl.overwrite(Ext.get(Ext.query('#video .comments-section a.name')[0]), { num: videoMeta && videoMeta[''] ? videoMeta[''] : 0 }); } }, renderHoverMenuMeta: function(cmp) { Loading