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