Upgrade to ExtJS 4.0.1 - Released 05/18/2011
[extjs.git] / docs / js / PageHeader.js
diff --git a/docs/js/PageHeader.js b/docs/js/PageHeader.js
new file mode 100644 (file)
index 0000000..faf5795
--- /dev/null
@@ -0,0 +1,37 @@
+/**
+ * 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>',
+                    '<tpl if="xtype">',
+                        '<span>xtype: {xtype}</span>',
+                    '</tpl>',
+                '</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));
+    }
+});