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

Merged Docs.Index into Docs.App class.

parent 57664155
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -117,7 +117,6 @@
  <script type="text/javascript" src="js/ClassPanel.js"></script>
  <script type="text/javascript" src="js/SourceCodePanel.js"></script>
  <script type="text/javascript" src="js/Guides.js"></script>
  <script type="text/javascript" src="js/Index.js"></script>

  <script type="text/javascript" src="js/search.js"></script>
  <script type="text/javascript" src="js/init.js"></script>
+46 −1
Original line number Diff line number Diff line
/**
 * Global functions that I don't know where else to put.
 * Manages the front page and switching between the main parts of docs
 * app.
 */
Ext.define("Docs.App", {
    singleton: true,

    /**
     * Returns base URL used for making AJAX requests.
     * @return {String} URL
     */
    getBaseUrl: function() {
        return document.location.href.replace(/#.*/, "").replace(/index.html/, "");
    },

    /**
     * Initializes listeners for all kind of links on front page.
     */
    init: function() {
        // load front page when clicked on logo
        Ext.get(Ext.query(".header > h2 > a")[0]).addListener('click', function() {
            this.setIndexMode();
        }, this, {preventDefault: true});

        // load guide when clicked on guide link
        Ext.Array.forEach(Ext.query("#api-overview .guides a"), function(el) {
            Ext.get(el).addListener('click', function() {
                this.setGuideMode();
                Docs.Guides.load(el.href);
            }, this, {preventDefault: true});
        }, this);
    },

    setIndexMode: function() {
        Ext.get("top-block").setStyle({display: 'block'});
        Ext.get("top-block").update('<h1>Ext JS 4.0 API Documentation</h1>');

        Ext.get("api-overview").setStyle({display: 'block'});
        Ext.get("api-guide").setStyle({display: 'none'}).update("");
        Ext.get("api-class").setStyle({display: 'none'});
    },

    setGuideMode: function() {
        Ext.get("top-block").setStyle({display: 'none'});

        Ext.get("api-overview").setStyle({display: 'none'});
        Ext.get("api-guide").setStyle({display: 'block'});
        Ext.get("api-class").setStyle({display: 'none'});
    },

    setClassMode: function() {
        Ext.get("top-block").setStyle({display: 'block'});

        Ext.get("api-overview").setStyle({display: 'none'});
        Ext.get("api-guide").setStyle({display: 'none'}).update("");
        Ext.get("api-class").setStyle({display: 'block'});
    }
});

template/js/Index.js

deleted100644 → 0
+0 −49
Original line number Diff line number Diff line
/**
 * Manages the front page of docs.
 */
Ext.define("Docs.Index", {
    singleton: true,

    /**
     * Initializes listeners for all kind of links on front page.
     */
    init: function() {
        // load front page when clicked on logo
        Ext.get(Ext.query(".header > h2 > a")[0]).addListener('click', function() {
            this.setIndexMode();
        }, this, {preventDefault: true});

        // load guide when clicked on guide link
        Ext.Array.forEach(Ext.query("#api-overview .guides a"), function(el) {
            Ext.get(el).addListener('click', function() {
                this.setGuideMode();
                Docs.Guides.load(el.href);
            }, this, {preventDefault: true});
        }, this);
    },

    setIndexMode: function() {
        Ext.get("top-block").setStyle({display: 'block'});
        Ext.get("top-block").update('<h1>Ext JS 4.0 API Documentation</h1>');

        Ext.get("api-overview").setStyle({display: 'block'});
        Ext.get("api-guide").setStyle({display: 'none'}).update("");
        Ext.get("api-class").setStyle({display: 'none'});
    },

    setGuideMode: function() {
        Ext.get("top-block").setStyle({display: 'none'});

        Ext.get("api-overview").setStyle({display: 'none'});
        Ext.get("api-guide").setStyle({display: 'block'});
        Ext.get("api-class").setStyle({display: 'none'});
    },

    setClassMode: function() {
        Ext.get("top-block").setStyle({display: 'block'});

        Ext.get("api-overview").setStyle({display: 'none'});
        Ext.get("api-guide").setStyle({display: 'none'}).update("");
        Ext.get("api-class").setStyle({display: 'block'});
    }
});
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ var getDocClass = function(cls, noHistory) {
        Docs.History.push(cls);
    }

    Docs.Index.setClassMode();
    Docs.App.setClassMode();
    var docTabPanel = Ext.getCmp('docTabPanel');
    if (docTabPanel) {
        Ext.getCmp('docTabPanel').setActiveTab(0);
+1 −1
Original line number Diff line number Diff line
@@ -9,7 +9,7 @@ Ext.onReady(function() {
    };

    Ext.tip.QuickTipManager.init();
    Docs.Index.init();
    Docs.App.init();
    Docs.History.init();

    Ext.create('Docs.ClassTree', {