Roo/bootstrap/NavItem.js
authorAlan Knowles <alan@roojs.com>
Thu, 4 Dec 2014 07:32:35 +0000 (15:32 +0800)
committerAlan Knowles <alan@roojs.com>
Thu, 4 Dec 2014 07:32:35 +0000 (15:32 +0800)
Roo/bootstrap/NavItem.js

index 288cdec..09fd470 100644 (file)
@@ -68,6 +68,12 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
             cls: 'nav-item',
             
         }
+        if (this.active) {
+            cfg.cls = typeof(cfg.cls) == 'undefined' ? 'active' : cfg.cls + ' active';
+        }
+        if (this.disabled) {
+            cfg.cls += ' disabled';
+        }
         if (this.href || this.html) {
             cfg.cn = [
                 {
@@ -76,37 +82,32 @@ Roo.extend(Roo.bootstrap.NavItem, Roo.bootstrap.Component,  {
                     html: this.html || ''
                 }
             ]
-        }
-        if (this.active) {
-            cfg.cls = typeof(cfg.cls) == 'undefined' ? 'active' : cfg.cls + ' active';
-        }
-            
+        
         // glyphicon and icon go before content..
-        if (this.glyphicon || this.icon) {
-             if (this.icon) {
-                cfg.cn[0].html = '<i class="'+this.icon+'"></i> <span>' + cfg.cn[0].html + '</span>'
-            } else {
-                cfg.cn[0].html = '<span class="glyphicon glyphicon-' + this.glyphicon + '"></span> '  + cfg.cn[0].html;
+            if (this.glyphicon || this.icon) {
+                 if (this.icon) {
+                    cfg.cn[0].html = '<i class="'+this.icon+'"></i> <span>' + cfg.cn[0].html + '</span>'
+                } else {
+                    cfg.cn[0].html = '<span class="glyphicon glyphicon-' + this.glyphicon + '"></span> '  + cfg.cn[0].html;
+                }
             }
-        }
-        
-        
-        
-        if (this.menu) {
             
-            cfg.cn[0].html += " <span class='caret'></span>";
-         
-        }
-        
-        if (this.badge !== '') {
+            
+            
+            if (cfg.cn  && this.menu) {
+                
+                cfg.cn[0].html += " <span class='caret'></span>";
              
-            cfg.cn[0].html += ' <span class="badge">' + this.badge + '</span>';
-        }
-        if (this.disabled) {
-            cfg.cls += ' disabled';
+            }
+            
+            if (this.badge !== '') {
+                 
+                cfg.cn[0].html += ' <span class="badge">' + this.badge + '</span>';
+            }
         }
         
         
+        
         return cfg;
     },
     initEvents: function() {