Roo/bootstrap/NavHeaderbar.js
authorAlan Knowles <alan@roojs.com>
Thu, 21 Aug 2014 07:20:35 +0000 (15:20 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 21 Aug 2014 07:20:35 +0000 (15:20 +0800)
Roo/bootstrap/NavHeaderbar.js

index 6c15df1..ac6e154 100644 (file)
@@ -26,10 +26,75 @@ Roo.extend(Roo.bootstrap.NavHeaderbar, Roo.bootstrap.Navbar,  {
     getAutoCreate : function(){
         
         
-        return  {
-            tag: 'div',
-            cls: 'sidebar-nav'
-        };
+        
+        var   cfg = {
+                tag: this.nav || 'nav',
+                cls: 'navbar',
+                role: 'navigation',
+                cn: [
+                    {
+                        tag: 'div',
+                        cls: 'navbar-header',
+                        cn: [
+                            {
+                            tag: 'button',
+                            type: 'button',
+                            cls: 'navbar-toggle',
+                            'data-toggle': 'collapse',
+                            cn: [
+                                {
+                                    tag: 'span',
+                                    cls: 'sr-only',
+                                    html: 'Toggle navigation'
+                                },
+                                {
+                                    tag: 'span',
+                                    cls: 'icon-bar'
+                                },
+                                {
+                                    tag: 'span',
+                                    cls: 'icon-bar'
+                                },
+                                {
+                                    tag: 'span',
+                                    cls: 'icon-bar'
+                                }
+                            ]
+                            }
+                        ]
+                    },
+                    {
+                    tag: 'div',
+                    cls: 'collapse navbar-collapse'
+                    }
+                ]
+            };
+            
+            cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
+            
+            if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
+                cfg.cls += ' navbar-' + this.position;
+                // 
+                cfg.tag = this.position  == 'fixed-bottom' ? 'footer' : 'header';
+            }
+            
+            if (this.brand !== '') {
+                cfg.cn[0].cn.push({
+                    tag: 'a',
+                    href: this.brand_href ? this.brand_href : '#',
+                    cls: 'navbar-brand',
+                    cn: [
+                    this.brand
+                    ]
+                });
+            }
+            
+            if(this.main){
+                cfg.cls += ' main-nav';
+            }
+            
+            
+            return cfg;
     
         
     }