diff --git a/Rakefile b/Rakefile index 37f2148e642fd58c07d70d9b39e98a00f81316e0..4b5a2ed48fc5468624a0555e3f605bd50b8de29d 100644 --- a/Rakefile +++ b/Rakefile @@ -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", diff --git a/lib/jsduck/app.rb b/lib/jsduck/app.rb index 9a16d6503a0342326bc68f51b496765b9bdeefd7..2c2fcd54e8409754d33474ec2a61c1c923e5999b 100644 --- a/lib/jsduck/app.rb +++ b/lib/jsduck/app.rb @@ -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, diff --git a/lib/jsduck/options.rb b/lib/jsduck/options.rb index 6f953afa25280e1d83a543c46913a3ac683c3138..c079ac9cad31fc174cef5870d867620ff0cb261c 100644 --- a/lib/jsduck/options.rb +++ b/lib/jsduck/options.rb @@ -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 diff --git a/template/app/controller/Examples.js b/template/app/controller/Examples.js index 9fbde1935a43f52b4affeeefaeaff4d012c67174..6754a9914847e23b59e38c91862f3abbe6eb6ad0 100644 --- a/template/app/controller/Examples.js +++ b/template/app/controller/Examples.js @@ -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'); diff --git a/template/app/view/Viewport.js b/template/app/view/Viewport.js index 89e053bebecbf0cd245b5987db4626e7f6c6cdeb..233b9459a7d0f5074ee581b5caa70f3c535f271a 100644 --- a/template/app/view/Viewport.js +++ b/template/app/view/Viewport.js @@ -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' } ] diff --git a/template/app/view/examples/Container.js b/template/app/view/examples/Container.js index d1c8feb3ff5019c1affff994d2d30e05392c7db7..0972d53801c14a0147d46f1f4c1fa23b9cba132e 100644 --- a/template/app/view/examples/Container.js +++ b/template/app/view/examples/Container.js @@ -4,40 +4,13 @@ * Renders the example inside iframe. */ Ext.define('Docs.view.examples.Container', { - extend: 'Ext.panel.Panel', + extend: 'Ext.container.Container', alias: 'widget.examplecontainer', layout: 'fit', - cls: 'example-container iScroll', - autoScroll: true, - bodyPadding: '10 0 5 0', - initComponent: function() { - this.dockedItems = [{ - xtype: 'container', - dock: 'top', - html: [ - '