roojs-bootstrap.js
authorAlan Knowles <alan@roojs.com>
Wed, 29 Jan 2014 15:03:02 +0000 (23:03 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 29 Jan 2014 15:03:02 +0000 (23:03 +0800)
roojs-bootstrap-debug.js

roojs-bootstrap-debug.js
roojs-bootstrap.js

index 004d0f5..ae099e2 100644 (file)
@@ -534,6 +534,10 @@ Roo.extend(Roo.bootstrap.Column, Roo.bootstrap.Component,  {
  * @cfg {Boolean} jumbotron is it a jumbotron element
  * @cfg {String} html content of element
  * @cfg {String} well (lg|sm|md) a well, large, small or medium.
+ * @cfg {String} panel (primary|success|info|warning|danger) render as a panel.
+ * @cfg {String} header content of header (for panel)
+ * @cfg {String} footer content of footer (for panel)
+ * 
  *    
  * @constructor
  * Create a new Container
@@ -548,6 +552,18 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
     
     jumbotron : false,
     well: '',
+    panel : '',
+    header: '',
+    footer : '',
+     
+    getChildContainer : function() {
+        if (this.panel.length) {
+            return this.el.select('.panel-body',true).first();
+        }
+        
+        return this.el;
+    },
+    
     
     getAutoCreate : function(){
         
@@ -559,7 +575,7 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
             cfg.cls = 'jumbotron';
         }
         if (this.cls) {
-            cfg.cls = '';
+            cfg.cls = this.cls;
         }
         
         if (this.well.length) {
@@ -574,7 +590,39 @@ Roo.extend(Roo.bootstrap.Container, Roo.bootstrap.Component,  {
             }
         }
         
-        cfg.html = this.html || cfg.html;
+        var body = cfg;
+        
+        if (this.panel.length) {
+            cfg.cls += 'panel panel-' + this.panel;
+            cfg.cn = [];
+            if (this.header.length) {
+                cfg.cn.push({
+                    tag: 'h3',
+                    cls : 'panel-heading',
+                    html : this.header
+                });
+            }
+            body = false;
+            cfg.cn.push({
+                cls : 'panel-body',
+                html : this.html
+            });
+            
+            
+            if (this.footer.length) {
+                cfg.cn.push({
+                    tag: 'h3',
+                    cls : 'panel-footer',
+                    html : this.footer
+                });
+            }
+            
+        }
+        if (body) {
+            body.html = this.html || cfg.html;
+        }
+        
+        
         return cfg;
     }
    
index 1420ddf..90b16e0 100644 (file)
@@ -15,8 +15,8 @@ A.cls+=this.size.length?(' btn-'+this.size):'';if(this.parentType==='Navbar'){A.
 //Roo/bootstrap/Column.js
 Roo.bootstrap.Column=function(A){Roo.bootstrap.Column.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Column,Roo.bootstrap.Component,{xs:null,sm:null,md:null,lg:null,html:'',offset:0,getAutoCreate:function(){var A=Roo.apply({},Roo.bootstrap.Column.superclass.getAutoCreate.call(this));A={tag:'div',cls:'column'};var B=this;['xs','sm','md','lg'].map(function(C){if(B[C]){A.cls+=' col-'+C+'-'+B[C];}});if(this.html.length){A.html=html;}return A;}});
 //Roo/bootstrap/Container.js
-Roo.bootstrap.Container=function(A){Roo.bootstrap.Container.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Container,Roo.bootstrap.Component,{jumbotron:false,well:'',getAutoCreate:function(){var A={cls:'container',html:''};if(this.jumbotron){A.cls='jumbotron';}if(this.cls){A.cls='';}if(this.well.length){switch(this.well){case 'lg':case 'sm':A.cls+'well well-'+this.well;break;default:A.cls+'well';break;}}
-A.html=this.html||A.html;return A;}});
+Roo.bootstrap.Container=function(A){Roo.bootstrap.Container.superclass.constructor.call(this,A);};Roo.extend(Roo.bootstrap.Container,Roo.bootstrap.Component,{jumbotron:false,well:'',panel:'',header:'',footer:'',getChildContainer:function(){if(this.panel.length){return this.el.select('.panel-body',true).first();}return this.el;},getAutoCreate:function(){var A={cls:'container',html:''};if(this.jumbotron){A.cls='jumbotron';}if(this.cls){A.cls=this.cls;}if(this.well.length){switch(this.well){case 'lg':case 'sm':A.cls+'well well-'+this.well;break;default:A.cls+'well';break;}}var B=A;if(this.panel.length){A.cls+='panel panel-'+this.panel;A.cn=[];if(this.header.length){A.cn.push({tag:'h3',cls:'panel-heading',html:this.header});}
+B=false;A.cn.push({cls:'panel-body',html:this.html});if(this.footer.length){A.cn.push({tag:'h3',cls:'panel-footer',html:this.footer});}}if(B){B.html=this.html||A.html;}return A;}});
 //Roo/bootstrap/Form.js
 Roo.bootstrap.Form=function(A){Roo.bootstrap.Form.superclass.constructor.call(this,A);this.addEvents({clientvalidation:true,rendered:true});};Roo.extend(Roo.bootstrap.Form,Roo.bootstrap.Component,{getAutoCreate:function(){var A={tag:'form',method:this.method||'POST',id:this.id||Roo.id(),cls:''};if(this.labelAlign=='left'){A.cls+=' form-horizontal';}return A;}});
 //Roo/bootstrap/Img.js