Commit bad0d7d3 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Fix bug with switching to index page and back.

The activeUrl was not set when switching to index page, so when
one tried to switch back to the previously visited page, that
page was still listed in activeUrl, and the switching was cancelled.

Now all pages are switched through the Classes controller.
parent 5b3bed61
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -24,7 +24,7 @@ Ext.define("Docs.History", {
            Docs.App.getController('Classes').showGuide(url.url, true);
        }
        else {
            Ext.getCmp('card-panel').layout.setActiveItem(0);
            Docs.App.getController('Classes').showIndex(true);
        }
    },

+25 −0
Original line number Diff line number Diff line
@@ -147,6 +147,20 @@ Ext.define('Docs.controller.Classes', {
        return event.button === this.MIDDLE || event.shiftKey || event.ctrlKey;
    },

    /**
     * Loads main page.
     *
     * @param {Boolean} noHistory  true to disable adding entry to browser history
     */
    showIndex: function(noHistory) {
        this.activeUrl = "";
        if (!noHistory) {
            Docs.History.push("");
        }
        this.getViewport().setPageTitle("");
        Ext.getCmp('card-panel').layout.setActiveItem(0);
    },

    cache: {},

    /**
@@ -217,6 +231,12 @@ Ext.define('Docs.controller.Classes', {
        this.getFavoritesGrid().selectUrl("/api/"+cls.name);
    },

    /**
     * Loads guide.
     *
     * @param {String} url  URL of the guide
     * @param {Boolean} noHistory  true to disable adding entry to browser history
     */
    showGuide: function(url, noHistory) {
        if (this.activeUrl === url) return;
        this.activeUrl = url;
@@ -243,6 +263,11 @@ Ext.define('Docs.controller.Classes', {
        });
    },

    /**
     * Displays page with 404 error message.
     *
     * @param {String} msg
     */
    showFailure: function(msg) {
        this.getOverview().setLoading(false);
        var tpl = new Ext.XTemplate(
+1 −3
Original line number Diff line number Diff line
@@ -44,9 +44,7 @@ Ext.define('Docs.view.Viewport', {
                        ui: 'hmm',
                        listeners: {
                            click: function() {
                                this.setPageTitle("");
                                Ext.getCmp('card-panel').layout.setActiveItem(0);
                                Docs.History.push("");
                                Docs.App.getController('Classes').showIndex();
                            },
                            scope: this
                        }