Roo/bootstrap/NavGroup.js
[roojs1] / Roo / bootstrap / NavGroup.js
1 /*
2  * - LGPL
3  *
4  * nav group
5  * 
6  */
7
8 /**
9  * @class Roo.bootstrap.NavGroup
10  * @extends Roo.bootstrap.Component
11  * Bootstrap NavGroup class
12  * @cfg {String} align left | right
13  * @cfg {Boolean} inverse false | true
14  * @cfg {String} type (nav|pills|tab) default nav
15  * @cfg {Boolean} disable (true|false) disable the bar, add marks
16  * 
17  * @constructor
18  * Create a new nav group
19  * @param {Object} config The config object
20  */
21
22 Roo.bootstrap.NavGroup = function(config){
23     Roo.bootstrap.NavGroup.superclass.constructor.call(this, config);
24 };
25
26 Roo.extend(Roo.bootstrap.NavGroup, Roo.bootstrap.Component,  {
27     
28     align: '',
29     inverse: false,
30     form: false,
31     type: 'nav',
32     disable : false,
33     
34     getAutoCreate : function(){
35         var cfg = Roo.apply({}, Roo.bootstrap.NavGroup.superclass.getAutoCreate.call(this));
36         
37         cfg = {
38             tag : 'ul',
39             cls: 'nav' 
40         }
41         
42         if (['tabs','pills'].indexOf(this.type)!==-1) {
43             cfg.cls += ' nav-' + this.type
44         } else {
45             if (this.type!=='nav') {
46                 Roo.log('nav type must be nav/tabs/pills')
47             }
48             cfg.cls += ' navbar-nav'
49         }
50         
51         if (this.parent().sidebar === true) {
52             cfg = {
53                 tag: 'ul',
54                 cls: 'dashboard-menu'
55             }
56             
57             return cfg;
58         }
59         
60         if (this.form === true) {
61             cfg = {
62                 tag: 'form',
63                 cls: 'navbar-form'
64             }
65             
66             if (this.align === 'right') {
67                 cfg.cls += ' navbar-right';
68             } else {
69                 cfg.cls += ' navbar-left';
70             }
71         }
72         
73         if (this.align === 'right') {
74             cfg.cls += ' navbar-right';
75         }
76         
77         if (this.inverse) {
78             cfg.cls += ' navbar-inverse';
79             
80         }
81         
82         
83         return cfg;
84     },
85     
86     initEvents :function ()
87     {
88         Roo.bootstrap.NavGroup.superclass.initEvents.call(this);
89         
90         var mark = {
91             tag: "div",
92             cls:"x-dlg-mask"
93         }
94         
95         this.maskEl = Roo.DomHelper.append(this.el, mark, true);
96         
97         var size = this.el.getSize();
98         
99         if(this.disable){
100             Roo.log('size!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!');
101             Roo.log(this.el);
102             var a = this.el.select('.dashboard-menu', true).first();
103             Roo.log(a);
104             
105         }
106         this.maskEl.setSize(size.width, size.height);
107         this.maskEl.enableDisplayMode("block");
108         
109         if(this.disable){
110             this.maskEl.show();
111         }
112     }
113    
114 });
115
116  
117
118