Commit 2f70679e authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Merge branch 'touch-examples'

parents d7c1a2d5 85a386a8
Loading
Loading
Loading
Loading
+10 −0
Original line number Diff line number Diff line
@@ -223,6 +223,9 @@ class JsDuckRunner
      "--footer", "Sencha Touch 2.0 Docs - Generated with <a href='https://github.com/senchalabs/jsduck'>JSDuck</a> revison #{revision}",
      "--categories", "#{@sdk_dir}/touch/docs/categories.json",
      "--videos", "#{@sdk_dir}/touch/docs/videos.json",
      "--guides", "#{@sdk_dir}/touch/docs/guides.json",
      "--examples", "#{@sdk_dir}/touch/docs/examples.json",
      "--touch-examples-ui",
      "--output", "#{@out_dir}",
      "--external=google.maps.Map,google.maps.LatLng",
      "--images", "#{@sdk_dir}/touch/docs/resources",
@@ -351,6 +354,11 @@ class JsDuckRunner
    system "cp -r #{@animator_dir}/docs/examples #{@out_dir}/extjs"
  end

  # Copy over Sencha Touch
  def copy_touch2_build
    system "cp -r #{@sdk_dir}/touch/build #{@out_dir}/touch"
  end

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

  runner.copy_touch2_build
end

desc "Run JSDuck on Sencha Animator (for internal use at Sencha)\n" +
+1 −0
Original line number Diff line number Diff line
@@ -262,6 +262,7 @@ module JsDuck
        "{extjs_path}" => @opts.extjs_path,
        "{local_storage_db}" => @opts.local_storage_db,
        "{show_print_button}" => @opts.seo ? "true" : "false",
        "{touch_examples_ui}" => @opts.touch_examples_ui ? "true" : "false",
        "{welcome}" => @welcome.to_html,
        "{categories}" => @categories.to_html,
        "{guides}" => @guides.to_html,
+7 −0
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ module JsDuck
    attr_accessor :template_links
    attr_accessor :extjs_path
    attr_accessor :local_storage_db
    attr_accessor :touch_examples_ui
    attr_accessor :ext_namespaces

    def initialize
@@ -103,6 +104,7 @@ module JsDuck
      @template_links = false
      @extjs_path = "extjs/ext-all.js"
      @local_storage_db = "docs"
      @touch_examples_ui = false
      @ext_namespaces = ["Ext"]
    end

@@ -296,6 +298,11 @@ module JsDuck
          @local_storage_db = name
        end

        opts.on('--touch-examples-ui',
          "Use phone/tablet UI for examples.", " ") do
          @touch_examples_ui = true
        end

        opts.on('--ext-namespaces=Ext,Foo', Array,
          "Namespace(s) of ExtJS. Defaults to 'Ext'.", " ") do |ns|
          @ext_namespaces = ns
+32 −0
Original line number Diff line number Diff line
@@ -45,6 +45,30 @@ Ext.define('Docs.controller.Examples', {
                urlclick: function(url) {
                    this.loadExample(url);
                }
            },
            'touchexamplecontainer': {
                afterrender: function(cmp) {
                    cmp.el.addListener('click', function(e, el) {
                        this.changeDevice('tablet');
                    }, this, {
                        delegate: 'button.tablet'
                    });
                    cmp.el.addListener('click', function(e, el) {
                        this.changeDevice('phone');
                    }, this, {
                        delegate: 'button.phone'
                    });
                    cmp.el.addListener('click', function(e, el) {
                        this.changeOrientation('portrait');
                    }, this, {
                        delegate: 'button.portrait'
                    });
                    cmp.el.addListener('click', function(e, el) {
                        this.changeOrientation('landscape');
                    }, this, {
                        delegate: 'button.landscape'
                    });
                }
            }
        });
    },
@@ -87,5 +111,13 @@ Ext.define('Docs.controller.Examples', {
            }, this);
        }
        return this.map[url];
    },

    changeOrientation: function(orientation) {
        this.getPage().setOrientation(orientation);
    },

    changeDevice: function(device) {
        this.getPage().setDevice(device);
    }
});
+3 −2
Original line number Diff line number Diff line
@@ -15,7 +15,8 @@ Ext.define('Docs.view.Viewport', {
        'Docs.view.videos.Index',
        'Docs.view.videos.Container',
        'Docs.view.examples.Index',
        'Docs.view.examples.Container'
        'Docs.view.examples.Container',
        'Docs.view.examples.TouchContainer'
    ],

    id: 'viewport',
@@ -128,7 +129,7 @@ Ext.define('Docs.view.Viewport', {
                                    id: 'exampleindex'
                                },
                                {
                                    xtype: 'examplecontainer',
                                    xtype: Docs.touchExamplesUi ? 'touchexamplecontainer' : 'examplecontainer',
                                    id: 'example'
                                }
                            ]
Loading