Commit 1523e518 authored by Rene Saarsoo's avatar Rene Saarsoo
Browse files

Rendering of class icon to page header.

Created separate class for dealing with the rendering.

Link from header to source file and fix prettify library links in
source files.  Also adjusted some class names and removed needless
top-block class from the containing div.
parent 3a3dc021
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -45,8 +45,8 @@ module JsDuck
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
  <title>The source code</title>
  <link href="../resources/prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../resources/prettify/prettify.js"></script>
  <link href="../prettify/prettify.css" type="text/css" rel="stylesheet" />
  <script type="text/javascript" src="../prettify/prettify.js"></script>
  <style type="text/css">
    .highlight { display: block; background-color: #ddd; }
  </style>
+2 −1
Original line number Diff line number Diff line
@@ -34,7 +34,7 @@
    <div id="container">
      <label style="float: right; padding: 10px 25px 0 0; display: none"><input type="checkbox" id="hideUnpopularClasses" />&nbsp; Popular classes</label>

      <div id="top-block" class="top-block">
      <div id="top-block">
        <h1>Ext JS 4.0 API Documentation</h1>
      </div>

@@ -70,6 +70,7 @@

  <script type="text/javascript" src="js/App.js"></script>
  <script type="text/javascript" src="js/History.js"></script>
  <script type="text/javascript" src="js/PageHeader.js"></script>
  <script type="text/javascript" src="js/ClassTree.js"></script>
  <script type="text/javascript" src="js/OverviewPanel.js"></script>
  <script type="text/javascript" src="js/OverviewToolbar.js"></script>
+34 −0
Original line number Diff line number Diff line
/**
 * Renders class name and icon in page header.
 */
Ext.define('Docs.PageHeader', {
    singleton: true,

    /**
     * Renders class in header.
     * @param {Object} docClass  class configuration object.
     */
    load: function(docClass) {
        if (!this.tpl) {
            this.tpl = new Ext.XTemplate(
                '<h1 class="{[this.getClass(values)]}">',
                    '<a href="source/{href}" target="_blank">{name}</a>',
                '</h1>',
                {
                    getClass: function(cls) {
                        if (cls.component) {
                            return "component";
                        }
                        else if (cls.singleton) {
                            return "singleton";
                        }
                        else {
                            return "class";
                        }
                    }
                }
            );
        }
        Ext.get('top-block').update(this.tpl.apply(docClass));
    }
});
+2 −1
Original line number Diff line number Diff line
@@ -71,13 +71,14 @@ var showClass = function(cls, anchor) {
        pageContent.setVisibilityMode(Ext.core.Element.DISPLAY).hide();
    }

    Docs.PageHeader.load(cls);

    var docOverviewTab = Ext.getCmp('doc-overview');
    docOverviewTab.load(cls);
    docOverviewTab.setLoading(false);

    prettyPrint();

    Ext.get(Ext.DomQuery.selectNode('#top-block > h1')).update(cls.name);
    if (anchor) {
        Ext.getCmp('doc-overview').scrollToEl("a[name=" + anchor + "]");
    } else {
+3 −3
Original line number Diff line number Diff line
@@ -211,17 +211,17 @@ pre, code, kbd, samp, tt
      letter-spacing: 0
      margin-left: 10px
      font-size: 0.6em
  h1.cls
  h1.class
    a
      background: url(../images/class-m.png) no-repeat 0 -5px
      margin-left: -12px
      padding: 0.1em 0 0.4em 2em
  h1.comp
  h1.component
    a
      background: url(../images/component-m.png) no-repeat 0 -5px
      margin-left: -12px
      padding: 0.1em 0 0.4em 2em
  h1.sing
  h1.singleton
    a
      background: url(../images/singleton-m.png) no-repeat 0 -5px
      margin-left: -12px