Commit 85a386a8 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Add --touch-examples-ui option.

Using this will switch on the Touch-style examples page where
examples are shown inside iPhone/iPad images.

For now the option will also decide from where the icons for examples
are loaded: touch/examles or extjs/examples/shared/screens

There are now two implementations of example container:

- Container
- TouchContainer
parent 97c23a2d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -225,6 +225,7 @@ class JsDuckRunner
      "--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",
+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
+1 −1
Original line number Diff line number Diff line
@@ -46,7 +46,7 @@ Ext.define('Docs.controller.Examples', {
                    this.loadExample(url);
                }
            },
            'examplecontainer': {
            'touchexamplecontainer': {
                afterrender: function(cmp) {
                    cmp.el.addListener('click', function(e, el) {
                        this.changeDevice('tablet');
+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