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

Fix regression Docs app in error message showing.

The error-handling code had gone out-of sync with the rest. The
Index controller had been renamed, and so error handling failed.

Now there is a separate Failure controller.

In addition to Classes and Guides, error messages are now also shown
when loading of videos or examples fails.
parent 59fdb863
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ Ext.define('Docs.Application', {
    controllers: [
        'Auth',
        'Welcome',
        'Failure',
        'Classes',
        'Comments',
        'CommentsMeta',
+3 −1
Original line number Diff line number Diff line
@@ -252,7 +252,9 @@ Ext.define('Docs.controller.Classes', {
                    this.showClass(json, member);
                },
                failure: function(response, opts) {
                    this.getController('Index').showFailure("Class <b>"+cls+"</b> was not found.");
                    this.cache[cls] = false;
                    this.getOverview().setLoading(false);
                    this.getController('Failure').show404("Class <b>"+cls+"</b> was not found.");
                },
                scope: this
            });
+4 −0
Original line number Diff line number Diff line
@@ -85,6 +85,10 @@ Ext.define('Docs.controller.Examples', {

    loadExample: function(url, noHistory) {
        var example = this.getExample(url);
        if (!example) {
            this.getController('Failure').show404("Example <b>"+url+"</b> was not found.");
            return;
        }
        this.getViewport().setPageTitle(example.text);
        if (this.activeUrl !== url) {
            this.getPage().clear();
+36 −0
Original line number Diff line number Diff line
/**
 * Controller for Error messages.
 */
Ext.define('Docs.controller.Failure', {
    extend: 'Docs.controller.Content',
    baseUrl: "#",

    refs: [
        {
            ref: 'viewport',
            selector: '#viewport'
        },
        {
            ref: 'index',
            selector: '#failure'
        }
    ],

    /**
     * Displays page with 404 error message.
     * @param {String} msg
     * @private
     */
    show404: function(msg) {
        var tpl = new Ext.XTemplate(
            "<h1>Oops...</h1>",
            "<p>{msg}</p>",
            "<p>Maybe it was renamed to something else? Or maybe it has passed away permanently to the 404 land? ",
            "This would be sad. Hopefully it's just a bug in our side. ",
            "Report it to <a href='http://www.sencha.com/forum/showthread.php?135036'>Sencha Forum</a> if you feel so.</p>",
            "<p>Sorry for all this :(</p>"
        );
        Ext.getCmp("failure").update(tpl.apply({msg: msg}));
        Ext.getCmp('card-panel').layout.setActiveItem("failure");
    }
});
+2 −1
Original line number Diff line number Diff line
@@ -113,7 +113,8 @@ Ext.define('Docs.controller.Guides', {
                    this.showGuide(json, url, name);
                },
                failure: function(response, opts) {
                    this.getController('Index').showFailure("Guide <b>"+name+"</b> was not found.");
                    this.cache[name] = false;
                    this.getController('Failure').show404("Guide <b>"+name+"</b> was not found.");
                },
                scope: this
            });
Loading