Commit 03e4893f authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Set favicons and height without waiting store load.

Favorites and Settings are force-loaded before viewport is created,
so they can be used right away in all views.

Also set up resize listener in listeners config, not in afterrender.
parent 38aa8c74
Loading
Loading
Loading
Loading
+0 −12
Original line number Diff line number Diff line
@@ -26,18 +26,6 @@ Ext.define('Docs.Application', {

        Ext.create('Docs.view.Viewport');

        Ext.getStore('Settings').on('load', function(store) {

            var favHeight = Docs.Settings.get('favorites-height');

            if (favHeight) {
                var tabPanel = Ext.getCmp('classes-tab-panel');
                tabPanel.suspendEvents();
                tabPanel.setHeight(favHeight);
                tabPanel.resumeEvents();
            }
        });

        Docs.History.init();

        // When google analytics event tracking script present on page
+5 −9
Original line number Diff line number Diff line
@@ -12,6 +12,7 @@ Ext.define('Docs.view.Viewport', {
        'Docs.view.tree.Tree',
        'Docs.view.ClassGrid',
        'Docs.Favorites',
        'Docs.Settings',
        'Docs.History'
    ],

@@ -85,7 +86,7 @@ Ext.define('Docs.view.Viewport', {
                                id: 'classes-tab-panel',
                                xtype: 'tabpanel',
                                region: 'north',
                                height: 150,
                                height: Docs.Settings.get('favorites-height') || 150,
                                padding: '2 4 0 0',
                                bodyPadding: '8 15 8 12',
                                border: false,
@@ -95,14 +96,9 @@ Ext.define('Docs.view.Viewport', {
                                    afterRender: function() {
                                        // Add 7px padding at left side of tab-bar
                                        this.tabBar.insert(0, {width: 7, xtype: 'container'});

                                        this.on('resize', function(cls, w, h) {
                                    },
                                    resize: function(cmp, w, h) {
                                        Docs.Settings.set('favorites-height', h);
                                        });
                                        var favHeight = Docs.Settings.get('favorites-height');
                                        if (favHeight) {
                                            this.setHeight(favHeight);
                                        }
                                    }
                                },
                                items: [
+3 −10
Original line number Diff line number Diff line
@@ -35,17 +35,10 @@ Ext.define('Docs.view.tree.Tree', {

        this.callParent();

        // Add links for favoriting classes
        //
        // Wait for the Favorites to load, then wait for tree to render,
        // after which add the fav icons.
        //
        // Do all this after callParent, because the getRootNode() will work
        // after initComponent has run.
        // Add links for favoriting classes.
        // Do this after callParent, because the getRootNode() will
        // work after initComponent has run.
        Docs.Favorites.setTree(this);
        // Ext.getStore("Favorites").on("load", function() {
        //     this.rendered ? this.initFavIcons() : this.on("render", this.initFavIcons, this);
        // }, this);
        this.initFavIcons();
    },