Roo/bootstrap/panel/Content.js
[roojs1] / Roo / bootstrap / panel / Content.js
index 4cb6f93..a972b73 100644 (file)
@@ -28,6 +28,8 @@
  * @cfg {Boolean} loadOnce      When used with {@link #url}, calls {@link #setUrl} with this value
  * @cfg {String}    content        Raw content to fill content panel with (uses setContent on construction.)
  * @cfg {Boolean} badges render the badges
+ * @cfg {String} cls  extra classes to use  
+ * @cfg {String} background (primary|secondary|success|info|warning|danger|light|dark)
 
  * @constructor
  * Create a new ContentPanel.
@@ -55,10 +57,11 @@ Roo.bootstrap.panel.Content = function( config){
             this.el = Roo.DomHelper.append(document.body,
                         config.autoCreate, true);
         }else{
-            var elcfg =  {   tag: "div",
-                            cls: "roo-layout-inactive-content",
-                            id: config.id||el
-                            };
+            var elcfg =  {
+                tag: "div",
+                cls: "roo-layout-inactive-content",
+                id: config.id||el
+            };
             if (config.html) {
                 elcfg.html = config.html;
                 
@@ -226,10 +229,13 @@ Roo.extend(Roo.bootstrap.panel.Content, Roo.bootstrap.Component, {
         this.active = active;
         this.setActiveClass(active);
         if(!active){
-            this.fireEvent("deactivate", this);
-        }else{
-            this.fireEvent("activate", this);
+            if(this.fireEvent("deactivate", this) === false){
+                return false;
+            }
+            return true;
         }
+        this.fireEvent("activate", this);
+        return true;
     },
     /**
      * Updates this panel's element
@@ -339,15 +345,13 @@ panel.load({
         }
         if(this.toolbar){
             var te = this.toolbar.getEl();
-            height -= te.getHeight();
             te.setWidth(width);
+            height -= te.getHeight();
         }
         if(this.footer){
             var te = this.footer.getEl();
-            Roo.log("footer:" + te.getHeight());
-            
-            height -= te.getHeight();
             te.setWidth(width);
+            height -= te.getHeight();
         }
         
         
@@ -374,7 +378,27 @@ panel.load({
      * @return {String} 
      */
     getTitle : function(){
-        return this.title;
+        
+        if (typeof(this.title) != 'object') {
+            return this.title;
+        }
+        
+        var t = '';
+        for (var k in this.title) {
+            if (!this.title.hasOwnProperty(k)) {
+                continue;
+            }
+            
+            if (k.indexOf('-') >= 0) {
+                var s = k.split('-');
+                for (var i = 0; i<s.length; i++) {
+                    t += "<span class='visible-"+s[i]+"'>"+this.title[k]+"</span>";
+                }
+            } else {
+                t += "<span class='visible-"+k+"'>"+this.title[k]+"</span>";
+            }
+        }
+        return t;
     },
     
     /**
@@ -382,7 +406,6 @@ panel.load({
      * @param {String} title
      */
     setTitle : function(title){
-        title = 'testing';
         this.title = title;
         if(this.region){
             this.region.updatePanelTitle(this, title);