Roo/bootstrap/NavHeaderbar.js
[roojs1] / Roo / bootstrap / NavHeaderbar.js
1 /*
2  * - LGPL
3  *
4  * navbar
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.NavHeaderbar
10  * @extends Roo.bootstrap.NavSimplebar
11  * Bootstrap Sidebar class
12  *
13  *
14  * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
15
16  * 
17  * @constructor
18  * Create a new Sidebar
19  * @param {Object} config The config object
20  */
21
22
23 Roo.bootstrap.NavHeaderbar = function(config){
24     Roo.bootstrap.NavHeaderbar.superclass.constructor.call(this, config);
25 };
26
27 Roo.extend(Roo.bootstrap.NavHeaderbar, Roo.bootstrap.NavSimplebar,  {
28     
29     position: '',
30
31     getAutoCreate : function(){
32         
33         
34         
35         var   cfg = {
36                 tag: this.nav || 'nav',
37                 cls: 'navbar',
38                 role: 'navigation',
39                 cn: [
40                     {
41                         tag: 'div',
42                         cls: 'navbar-header',
43                         cn: [
44                             {
45                             tag: 'button',
46                             type: 'button',
47                             cls: 'navbar-toggle',
48                             'data-toggle': 'collapse',
49                             cn: [
50                                 {
51                                     tag: 'span',
52                                     cls: 'sr-only',
53                                     html: 'Toggle navigation'
54                                 },
55                                 {
56                                     tag: 'span',
57                                     cls: 'icon-bar'
58                                 },
59                                 {
60                                     tag: 'span',
61                                     cls: 'icon-bar'
62                                 },
63                                 {
64                                     tag: 'span',
65                                     cls: 'icon-bar'
66                                 }
67                             ]
68                             }
69                         ]
70                     },
71                     {
72                     tag: 'div',
73                     cls: 'collapse navbar-collapse'
74                     }
75                 ]
76             };
77             
78             cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
79             
80             if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
81                 cfg.cls += ' navbar-' + this.position;
82                 // 
83                 cfg.tag = this.position  == 'fixed-bottom' ? 'footer' : 'header';
84             }
85             
86             if (this.brand !== '') {
87                 cfg.cn[0].cn.push({
88                     tag: 'a',
89                     href: this.brand_href ? this.brand_href : '#',
90                     cls: 'navbar-brand',
91                     cn: [
92                     this.brand
93                     ]
94                 });
95             }
96             
97             if(this.main){
98                 cfg.cls += ' main-nav';
99             }
100             
101             
102             return cfg;
103     
104         
105     }
106     
107     
108     
109 });
110
111
112
113  
114
115