remove debugging code
[roojs1] / Roo / bootstrap / Brick.js
index b3fe8fa..425b22b 100644 (file)
@@ -73,6 +73,14 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
             cls += ' roo-brick-image';
         }
         
+        if(!this.html.length && !this.bgimage.length){
+            cls += ' roo-brick-center-title';
+        }
+        
+        if(!this.html.length && this.bgimage.length){
+            cls += ' roo-brick-bottom-title';
+        }
+        
         if(this.cls){
             cls += ' ' + this.cls;
         }
@@ -109,6 +117,8 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
                 cls: 'roo-brick-text',
                 html: this.html
             });
+        } else {
+            cn.cls += ' hide';
         }
         
         if(this.bgimage.length){
@@ -124,26 +134,45 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
     
     initEvents: function() 
     {
-        this.el.on('mouseenter'  ,this.enter, this);
-        this.el.on('mouseleave', this.leave, this);
+        if(this.title.length || this.html.length){
+            this.el.on('mouseenter'  ,this.enter, this);
+            this.el.on('mouseleave', this.leave, this);
+        }
         
         Roo.EventManager.onWindowResize(this.resize, this); 
         
+        if(this.bgimage.length){
+            this.imageEl = this.el.select('.roo-brick-image-view', true).first();
+            this.imageEl.on('load', this.onImageLoad, this);
+            return;
+        }
+        
+        this.resize();
+    },
+    
+    onImageLoad : function()
+    {
         this.resize();
     },
     
     resize : function()
     {
         var paragraph = this.el.select('.roo-brick-paragraph', true).first();
-        paragraph.setHeight(paragraph.getWidth());
+        
+        paragraph.setHeight(paragraph.getWidth() + paragraph.getPadding('tb'));
         
         if(this.bgimage.length){
             var image = this.el.select('.roo-brick-image-view', true).first();
             
-            Roo.log([paragraph.getHeight(), paragraph.getWidth()]);
-            
             image.setWidth(paragraph.getWidth());
-            image.setHeight(paragraph.getHeight());
+            
+            if(this.square){
+                image.setHeight(paragraph.getWidth());
+            }
+            
+            this.el.setHeight(image.getHeight());
+            paragraph.setHeight(image.getHeight());
+            
         }
         
     },
@@ -154,6 +183,7 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
         
         if(this.bgimage.length){
             this.el.select('.roo-brick-paragraph', true).first().setOpacity(0.9, true);
+            this.el.select('.roo-brick-image-view', true).first().setOpacity(0.1, true);
         }
     },
     
@@ -163,6 +193,7 @@ Roo.extend(Roo.bootstrap.Brick, Roo.bootstrap.Component,  {
         
         if(this.bgimage.length){
             this.el.select('.roo-brick-paragraph', true).first().setOpacity(0, true);
+            this.el.select('.roo-brick-image-view', true).first().setOpacity(1, true);
         }
     }