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

Support for inline examples in guides.

parent 2965f0c9
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -133,8 +133,10 @@ Ext.define('Docs.controller.Guides', {
        }
        this.getViewport().setPageTitle(json.title);
        if (this.activeUrl !== url) {
            Ext.getCmp("guide").update('<a class="print guide" href="?print=/guide/' + name + '" target="_blank">Print</a>' + json.guide);
            Docs.Syntax.highlight(Ext.get("guide"));
            Ext.getCmp("guide").load({
                name: name,
                content: json.guide
            });
        }
        this.activeUrl = url;
        this.scrollContent();
+15 −11
Original line number Diff line number Diff line
@@ -59,7 +59,17 @@ Ext.define('Docs.controller.InlineExamples', {
                }
            },
            'classoverview': {
                resize: function() {
                resize: this.adjustSize,
                afterload: this.replaceExampleDivs
            },
            'guidecontainer': {
                resize: this.adjustSize,
                afterload: this.replaceExampleDivs
            }
        });
    },

    adjustSize: function() {
        Ext.Array.each(Ext.ComponentQuery.query('.inlineexample'), function(c) {
            if (c.codeEditor) {
                c.doLayout();
@@ -67,12 +77,6 @@ Ext.define('Docs.controller.InlineExamples', {
            }
        });
    },
                afterload: function() {
                    this.replaceExampleDivs();
                }
            }
        });
    },

    activateTab: function(cmp, buttonCls) {
        Ext.Array.each(cmp.up('inlineexample').query('toolbar button'), function(b) {
+2 −1
Original line number Diff line number Diff line
@@ -11,6 +11,7 @@ Ext.define('Docs.view.Viewport', {
        'Docs.view.cls.Index',
        'Docs.view.cls.Container',
        'Docs.view.guides.Index',
        'Docs.view.guides.Container',
        'Docs.view.videos.Index',
        'Docs.view.videos.Container',
        'Docs.view.examples.Index'
@@ -108,7 +109,7 @@ Ext.define('Docs.view.Viewport', {
                                },
                                {
                                    autoScroll: true,
                                    xtype: 'container',
                                    xtype: 'guidecontainer',
                                    id: 'guide',
                                    cls: 'iScroll'
                                },
+37 −0
Original line number Diff line number Diff line
/**
 * The guide page.
 *
 * Renders the guide and print button.
 */
Ext.define('Docs.view.guides.Container', {
    extend: 'Ext.container.Container',
    alias: 'widget.guidecontainer',
    componentCls: 'guide-container',

    initComponent: function() {
        this.addEvents(
            /**
             * @event
             * Fired after guide loaded.
             */
            'afterload'
        );
        this.callParent(arguments);
    },

    /**
     * Loads guide into the page.
     * @param {Object} guide
     */
    load: function(guide) {
        this.tpl = this.tpl || new Ext.XTemplate(
            '<a class="print guide" href="?print=/guide/{name}" target="_blank">Print</a>',
            '{content}'
        );

        this.update(this.tpl.apply(guide));
        Docs.Syntax.highlight(this.getEl());

        this.fireEvent('afterload');
    }
});
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -383,7 +383,7 @@ a {
  border: 0; }


.class-overview, #guide {
.class-overview, .guide-container {
  pre {
    background-color: #f7f7f7;
    border: solid 1px #e8e8e8;