Commit 2e55ec44 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Update comment counts on guide/video index pages.

parent 9c0f40c0
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -17,9 +17,17 @@ Ext.define('Docs.controller.CommentCounts', {
            ref: 'guide',
            selector: '#guide'
        },
        {
            ref: 'guideIndex',
            selector: '#guideindex'
        },
        {
            ref: 'video',
            selector: '#video'
        },
        {
            ref: 'videoIndex',
            selector: '#videoindex'
        }
    ],

@@ -30,7 +38,9 @@ Ext.define('Docs.controller.CommentCounts', {
    updateCounts: function(target, count) {
        this.getClass().updateCommentCounts();
        this.getGuide().updateCommentCounts();
        this.getGuideIndex().updateCommentCounts();
        this.getVideo().updateCommentCounts();
        this.getVideoIndex().updateCommentCounts();
    }

});
+12 −0
Original line number Diff line number Diff line
@@ -120,6 +120,18 @@ Ext.define('Docs.view.ThumbList', {
        }, this);
    },

    /**
     * Refreshes the comment counters.
     */
    updateCommentCounts: function() {
        if (!this.getEl()) {
            return;
        }

        this.getEl().select(".comment-counter-small").remove();
        this.initComments();
    },

    // Given groups data with subgroups like this:
    //
    // - group A
+7 −0
Original line number Diff line number Diff line
@@ -35,5 +35,12 @@ Ext.define('Docs.view.guides.Index', {
    getTab: function() {
        var enabled = (Docs.data.guides|| []).length > 0;
        return enabled ? {cls: 'guides', href: '#!/guide', tooltip: 'Guides'} : false;
    },

    /**
     * Refreshes the comment counters.
     */
    updateCommentCounts: function() {
        this.down("thumblist").updateCommentCounts();
    }
});
+7 −0
Original line number Diff line number Diff line
@@ -38,5 +38,12 @@ Ext.define('Docs.view.videos.Index', {
    getTab: function() {
        var enabled = (Docs.data.videos || []).length > 0;
        return enabled ? {cls: 'videos', href: '#!/video', tooltip: 'Videos'} : false;
    },

    /**
     * Refreshes the comment counters.
     */
    updateCommentCounts: function() {
        this.down("thumblist").updateCommentCounts();
    }
});