Commit 223dd99a authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix saving video/examples tabs.

Previously refreshing the page while example tab open, would close all other tabs.
Now first loading all the tabs and only after that performing history navigation.
parent 4ea059b5
Loading
Loading
Loading
Loading
+18 −1
Original line number Diff line number Diff line
@@ -9,11 +9,28 @@ Ext.define("Docs.History", {
     */
    init: function() {
        Ext.util.History.init(function() {
            this.navigate(Ext.util.History.getToken());
            this.historyLoaded = true;
            this.initialNavigate();
        }, this);

        Ext.util.History.on("change", this.navigate, this);
    },

    /**
     * Called from Tabs controller to notify that initial tabs loading had been done.
     */
    notifyTabsLoaded: function() {
        this.tabsLoaded = true;
        this.initialNavigate();
    },

    // Invoke initial navigation only after both tabs and history are loaded
    initialNavigate: function() {
        if (this.tabsLoaded && this.historyLoaded) {
            this.navigate(Ext.util.History.getToken());
        }
    },

    // Parses current URL and navigates to the page
    navigate: function(token) {
        var url = this.parseToken(token);
+5 −1
Original line number Diff line number Diff line
@@ -3,7 +3,10 @@
 */
Ext.define('Docs.controller.Tabs', {
    extend: 'Ext.app.Controller',
    requires: ['Docs.Settings'],
    requires: [
        'Docs.History',
        'Docs.Settings'
    ],

    refs: [
        {
@@ -93,6 +96,7 @@ Ext.define('Docs.controller.Tabs', {
                this.addTabFromTree(url, {});
            }, this);
        }
        Docs.History.notifyTabsLoaded();
    },

    /**