Commit eba1b47a authored by Nick Poulden's avatar Nick Poulden
Browse files

Inline Examples

parent 6223bfdb
Loading
Loading
Loading
Loading
+18 −7
Original line number Diff line number Diff line
@@ -119,6 +119,14 @@ Ext.define('Docs.controller.Classes', {
                        preventDefault: true,
                        delegate: '.not-expandable'
                    });
                },
                resize: function() {
                    Ext.Array.each(Ext.ComponentQuery.query('.inlineexample'), function(c) {
                        if (c.codeEditor) {
                            c.doLayout();
                            c.codeEditor.refresh();
                        }
                    });
                }
            }
        });
@@ -210,20 +218,23 @@ Ext.define('Docs.controller.Classes', {
            }
            classOverview.load(cls);

            this.getOverview().load(cls);
            this.getOverview().setLoading(false);

            Ext.Array.each(Ext.query('.inlineExample'), function(inlineEg) {
                var egId = inlineEg.getAttribute('rel');
                var divId = inlineEg.getAttribute('id');
                var eg = Ext.create('Docs.view.examples.Inline', {
                    height: 100,
                    renderTo: divId
                    height: 200,
                    renderTo: divId,
                    listeners: {
                        render: function() {
                            this.showExample(egId, true, true);
                        }
                    }
                });
                eg.showExample(egId);
            });

            this.getOverview().load(cls);

            this.getOverview().setLoading(false);

            this.getTree().selectClass(cls.name);
            this.fireEvent('showClass', cls.name);
        }
+9 −0
Original line number Diff line number Diff line
/**
 * Listeners should be defined here instead of in the view classes
 */
Ext.define('Docs.controller.Examples', {
    extend: 'Ext.app.Controller',



});
 No newline at end of file
+3 −2
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ Ext.define('Docs.view.cls.Overview', {
     * @param {Object} docClass
     */
    load: function(docClass) {

        this.docClass = docClass;

        if (this.toolbar) {
@@ -172,9 +173,9 @@ Ext.define('Docs.view.cls.Overview', {

        var egId = 0;
        var replaceExample = function() {
            var idx = cls.doc.match(/\{@example ([A-Za-z\/\.]+)\}/);
            var idx = cls.doc.match(/\{@example ([A-Za-z0-9_\/\.]+)\}/);
            if (idx) {
                cls.doc = cls.doc.replace(/\{@example ([A-Za-z\/\.]+)\}/, '<div class="inlineExample" id="eg' + egId + '" rel="' + idx[1] + '"></div>');
                cls.doc = cls.doc.replace(/\{@example ([A-Za-z0-9_\/\.]+)\}/, '<div class="inlineExample" id="eg' + egId + '" rel="' + idx[1] + '"></div>');
                egId += 1;
                replaceExample();
            }
+15 −3
Original line number Diff line number Diff line
@@ -4,20 +4,32 @@
      "title": "Simple Button",
      "primaryClass": "Ext.button.Button",
      "description": "Simple button with click handler",
      "location": "Ext.button.Button/simple.js"
      "location": "Ext.button.Button/01_simple.js"
    },
    {
      "title": "Toggle Button",
      "primaryClass": "Ext.button.Button",
      "description": "A button which retains its click state",
      "location": "Ext.button.Button/02_toggle.js"
    },
    {
      "title": "Menu Button",
      "primaryClass": "Ext.button.Button",
      "referencedClasses": ["Ext.menu.Menu"],
      "description": "Menu button with bottom aligned arrow",
      "location": "Ext.button.Button/menu.js"
      "location": "Ext.button.Button/03_menu.js"
    },
    {
      "title": "Basic Grid Panel",
      "primaryClass": "Ext.panel.Grid",
      "description": "Basic grid panel",
      "location": "Ext.grid.Panel/basic.js"
      "location": "Ext.grid.Panel/01_basic.js"
    },
    {
      "title": "Grouping Grid Panel",
      "primaryClass": "Ext.panel.Grid",
      "description": "Grouping grid panel",
      "location": "Ext.grid.Panel/02_grouping.js"
    },
    {
      "title": "Gist Grid Panel",
Loading