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

Optional dropdown for jumping to other docs

parent d66310d3
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -414,6 +414,29 @@ class JsDuckRunner
    system "cp -r #{@sdk_dir}/touch/build #{@out_dir}/touch"
  end

  def add_product_doc_urls
    @options += [
      "--body-html", <<-EOHTML
      <script type="text/javascript">
        Docs.otherProducts = [
          {
              text: 'Ext JS 4.0',
              href: 'http://docs.sencha.com/ext-js/4-0'
          },
          {
              text: 'Sencha Touch 2.0',
              href: 'http://docs.sencha.com/touch/2-0'
          },
          {
              text: 'Sencha Animator 1.0',
              href: 'http://docs.sencha.com/animator/1-0'
          }
        ];
      </script>
      EOHTML
    ]
  end

  def run
    # Pass multiple arguments to system, so we'll take advantage of the built-in escaping
    system(*["ruby", "bin/jsduck"].concat(@options))
@@ -496,6 +519,7 @@ task :touch2, [:mode] => :sass do |t, args|
  runner.add_touch2_export_notice if mode == "export"
  runner.set_touch2_src if mode == "export"
  runner.add_seo if mode == "debug" || mode == "live"
  runner.add_product_doc_urls if mode == "live"
  runner.run

  runner.copy_touch2_build if mode != "export"
+32 −0
Original line number Diff line number Diff line
Ext.define('Docs.view.Header', {
    extend: 'Ext.container.Container',
    alias: 'widget.docheader',

    contentEl: 'header-content',

    initComponent: function() {

        if (Docs.otherProducts) {
            this.style = 'cursor: pointer;',
            this.cls = 'dropdown';

            this.menu = Ext.create('Ext.menu.Menu', {
                renderTo: Ext.getBody(),
                plain: true,
                items: Docs.otherProducts
            });
        }

        this.callParent();
    },

    listeners: {
        afterrender: function(cmp) {
            if (this.menu) {
                cmp.el.addListener('click', function(cmp, el) {
                    this.menu.showBy(this.el, 'bl', [120, 0]);
                }, this);
            }
        }
    }
});
+4 −3
Original line number Diff line number Diff line
@@ -5,6 +5,7 @@ Ext.define('Docs.view.Viewport', {
    extend: 'Ext.container.Viewport',
    requires: [
        'Docs.view.search.Container',
        'Docs.view.Header',
        'Docs.view.Tabs',
        'Docs.view.TreeContainer',
        'Docs.view.welcome.Index',
@@ -24,6 +25,7 @@ Ext.define('Docs.view.Viewport', {
    defaults: { xtype: 'container' },

    initComponent: function() {

        this.items = [
            {
                region: 'north',
@@ -40,10 +42,9 @@ Ext.define('Docs.view.Viewport', {
                        layout: 'hbox',
                        items: [
                            {
                                xtype: 'container',
                                flex: 1,
                                contentEl: 'header-content'
                                xtype: 'docheader'
                            },
                            {   xtype: 'container', flex: 1 },
                            {
                                xtype: 'searchcontainer',
                                id: 'search-container',
+963 B
Loading image diff...
+5 −0
Original line number Diff line number Diff line
@@ -218,6 +218,11 @@ a {

#north-region {
  @include vertical-gradient(#074e7c, #095f93);

  .dropdown {
    padding-right: 15px;
    background: url(../images/down-arr.png) no-repeat bottom right;
  }
}

#footer {