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