Roo/bootstrap/Navbar.js
[roojs1] / Roo / bootstrap / Navbar.js
1 /*
2  * - LGPL
3  *
4  * navbar
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.Navbar
10  * @extends Roo.bootstrap.Component
11  * Bootstrap Navbar class
12  * @cfg {String} position (fixed-top|fixed-bottom|static-top) position
13  * @cfg {String} brand what is brand
14  * @cfg {Boolean} inverse is inverted color
15  * @cfg {String} type (nav | pills | tabs)
16  * @cfg {Boolean} arrangement stacked | justified
17  * @cfg {String} align (left | right) alignment
18  * @cfg {String} brand_href href of the brand
19  * @cfg {Boolean} main (true|false) main nav bar? default false
20  * @cfg {Boolean} loadMask (true|false) loadMask on the bar
21  * @cfg {String} tag (header|footer|nav|div) default is nav 
22
23  * 
24  * @constructor
25  * Create a new Navbar
26  * @param {Object} config The config object
27  */
28
29
30 Roo.bootstrap.Navbar = function(config){
31     Roo.bootstrap.Navbar.superclass.constructor.call(this, config);
32     
33 };
34
35 Roo.extend(Roo.bootstrap.Navbar, Roo.bootstrap.Component,  {
36     
37     
38     brand: '',
39     inverse: false,
40     position: '',
41     align : false,
42     type: false,
43     arrangement: '',
44     brand_href: false,
45     main : false,
46     loadMask : false,
47     tag : false,
48     
49     // private
50     navItems : false,
51     
52     getAutoCreate : function(){
53         
54         
55         throw { message : "nav bar is now a abstract base class - use SimpleBar / HeaderBar / SideBar etc..."};
56         
57     },
58     
59     initEvents :function ()
60     {
61         //Roo.log(this.el.select('.navbar-toggle',true));
62         this.el.select('.navbar-toggle',true).on('click', function() {
63            // Roo.log('click');
64             this.el.select('.navbar-collapse',true).toggleClass('in');                                 
65         }, this);
66         
67         var mark = {
68             tag: "div",
69             cls:"x-dlg-mask"
70         }
71         
72         this.maskEl = Roo.DomHelper.append(this.el, mark, true);
73         
74         var size = this.el.getSize();
75         this.maskEl.setSize(size.width, size.height);
76         this.maskEl.enableDisplayMode("block");
77         this.maskEl.hide();
78         
79         if(this.loadMask){
80             this.maskEl.show();
81         }
82     },
83     
84     
85     getChildContainer : function()
86     {
87         if (this.el.select('.collapse').getCount()) {
88             return this.el.select('.collapse',true).first();
89         }
90         
91         return this.el;
92     },
93     
94     mask : function()
95     {
96         this.maskEl.show();
97     },
98     
99     unmask : function()
100     {
101         this.maskEl.hide();
102     }
103     
104     
105     
106 });
107
108
109
110  
111
112