Commit a8831eac authored by Ed Spencer's avatar Ed Spencer
Browse files

Merge branch 'master' of github.com:senchalabs/jsduck

parents 203a1208 a1007163
Loading
Loading
Loading
Loading
+52 −1
Original line number Diff line number Diff line
@@ -95,6 +95,8 @@ def compress
  # Now do everything that follows in template-min/ dir
  dir = "template-min"

  # Create JSB3 file for Docs app
  system("sencha", "create", "jsb", "-a", "#{dir}/build-js.html", "-p", "#{dir}/app.jsb3")
  # Concatenate files listed in JSB3 file
  system("sencha", "build", "-p", "#{dir}/app.jsb3", "-d", dir)
  # Remove intermediate build files
@@ -254,6 +256,30 @@ class JsDuckRunner
    @options += extract_jsb_build_files("#{@sdk_dir}/touch/touch.jsb3")
  end

  def set_touch2_src
    relative_touch_path = "../"
    touch_iframe = "template-min/touchIframe.html";

    ["template-min/touchIframe.html", "template-min/touch-welcome.html"].each do |file|
      html = IO.read(file);

      touch_src_re = /((src|href)="touch)/m
      out = []

      html.each_line do |line|
        out << line.sub(/((src|href)="touch\/)/, '\2="' + relative_touch_path)
      end

      File.open(file, 'w') {|f| f.write(out) }
    end

    @options += [
      "--welcome", "template-min/touch-welcome.html",
      "--body-html",
        '<script type="text/javascript">Docs.exampleBaseUrl = "' + relative_touch_path + 'examples/";if (Ext.is.Phone) { window.location = "' + relative_touch_path + 'examples/"; }</script>'
    ]
  end

  def add_animator
    head_html = <<-EOHTML
      <link rel="canonical" href="http://docs.sencha.com/animator/1-0/" />
@@ -388,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))
@@ -468,10 +517,12 @@ task :touch2, [:mode] => :sass do |t, args|
  runner.add_touch2
  runner.add_debug if mode == "debug"
  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
  runner.copy_touch2_build if mode != "export"
end

desc "Run JSDuck JSON Export (for internal use at Sencha)\n" +

template/app.jsb3

deleted100644 → 0
+0 −1071

File deleted.

Preview size limit exceeded, changes collapsed.

+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',
+21 −11
Original line number Diff line number Diff line
@@ -32,6 +32,7 @@ Ext.define('Docs.view.examples.Device', {
        Ext.apply(this, this.getIframeSize());
        this.id = this.id || Ext.id();

        if (Ext.isWebKit) {
            // Template for the DIV containing device image and iframe
            this.tpl = new Ext.XTemplate(
                '<div class="touchExample {device} {orientation}">',
@@ -44,6 +45,15 @@ Ext.define('Docs.view.examples.Device', {
                    }
                }
            );
        } else {
            this.tpl = new Ext.XTemplate(
                '<div class="touchExample {device} {orientation}">',
                    '<div id={id} class="wrong-browser" style="width: {width}; height: {height};">',
                        '<div style="padding: 20px;">Sencha Touch only functions on WebKit based browsers. <br /><br />Please use Google Chrome or Safari to see live examples.</div>',
                    '</div>',
                '</div>'
            );
        }
    },

    /**
Loading