Roo/bootstrap/Navbar.Item.js
[roojs1] / Roo / bootstrap / Navbar.Item.js
1 /*
2  * - LGPL
3  *
4  * row
5  * 
6  */ 
7 Roo.bootstrap.Navbar.Item = function(config){
8     Roo.bootstrap.Navbar.Item.superclass.constructor.call(this, config);
9 };
10
11 Roo.extend(Roo.bootstrap.Navbar.Item, Roo.bootstrap.Component,  {
12     
13     href : false,
14     html : false,
15     badge : '',
16     
17     getAutoCreate : function(){
18         
19         var cfg = Roo.apply({}, Roo.bootstrap.Navbar.Item.superclass.getAutoCreate.call(this));
20         
21         cfg = {
22             tag: 'li'
23         }
24         cfg.cn = [
25             {
26                 tag: 'p',
27                 html: 'Text'
28             }
29         ];
30         
31         cfg.cn[0].html = this.html || cfg.cn[0].html ;
32         if (this.menu) {
33             cfg.cn[0].tag='a';
34             cfg.cn[0].href='#';
35         }else if (!this.href) {
36             cfg.cn[0].tag='p';
37             cfg.cn[0].cls='navbar-text';
38         } else {
39             cfg.cn[0].tag='a';
40             cfg.cn[0].href=this.href;
41             cfg.cn[0].html=this.html;
42         }
43         
44         if (this.badge !== '') {
45             
46             cfg.cn[0].cn=[
47                 cfg.cn[0].html + ' ',
48                 {
49                     tag: 'span',
50                     cls: 'badge',
51                     html: this.badge
52                 }
53             ];
54             cfg.cn[0].html=''
55         }
56          
57         
58         return cfg;
59     }
60    
61 });
62
63  
64
65