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