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  * @cfg {String} brand what is brand
14  * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
15  * @cfg {String} brand_href href of the brand
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     brand: '',
31     brand_href: false,
32     
33     
34     getAutoCreate : function(){
35         
36         
37         
38         var   cfg = {
39                 tag: this.nav || 'nav',
40                 cls: 'navbar',
41                 role: 'navigation',
42                 cn: [
43                     {
44                         tag: 'div',
45                         cls: 'navbar-header',
46                         cn: [
47                             {
48                             tag: 'button',
49                             type: 'button',
50                             cls: 'navbar-toggle',
51                             'data-toggle': 'collapse',
52                             cn: [
53                                 {
54                                     tag: 'span',
55                                     cls: 'sr-only',
56                                     html: 'Toggle navigation'
57                                 },
58                                 {
59                                     tag: 'span',
60                                     cls: 'icon-bar'
61                                 },
62                                 {
63                                     tag: 'span',
64                                     cls: 'icon-bar'
65                                 },
66                                 {
67                                     tag: 'span',
68                                     cls: 'icon-bar'
69                                 }
70                             ]
71                             }
72                         ]
73                     },
74                     {
75                     tag: 'div',
76                     cls: 'collapse navbar-collapse'
77                     }
78                 ]
79             };
80             
81             cfg.cls += this.inverse ? ' navbar-inverse' : ' navbar-default';
82             
83             if (['fixed-top','fixed-bottom','static-top'].indexOf(this.position)>-1) {
84                 cfg.cls += ' navbar-' + this.position;
85                 
86                 // tag can override this..
87                 
88                 cfg.tag = this.tag || (this.position  == 'fixed-bottom' ? 'footer' : 'header');
89             }
90             
91             if (this.brand !== '') {
92                 cfg.cn[0].cn.push({
93                     tag: 'a',
94                     href: this.brand_href ? this.brand_href : '#',
95                     cls: 'navbar-brand',
96                     cn: [
97                     this.brand
98                     ]
99                 });
100             }
101             
102             if(this.main){
103                 cfg.cls += ' main-nav';
104             }
105             
106             
107             return cfg;
108     
109         
110     }
111     
112     
113     
114 });
115
116
117
118  
119
120