roojs-core.js
[roojs1] / Roo / mailer / Column.js
1 /*
2  * - LGPL
3  *
4  * element
5  * <!-- BEGIN TEMPLATE // -->
6                         <table border="0" cellpadding="0" cellspacing="0" id="templateContainer">
7                                 <tr>
8                                 <td align="center" valign="top">
9                               
10  */
11
12 /**
13  * @class Roo.mailer.Column 
14  * @extends Roo.bootstrap.Component
15  * Bootstrap Element class
16  * @cfg {String} cls class of the element
17  * @cfg {String} html content of body
18  * @cfg {String} src image url
19  * @cfg {String} column  (left|right)
20  * @cfg {String width (100%|200|340|260)
21  * 
22  * @constructor
23  * Create a new Element
24  * @param {Object} config The config object
25  */
26
27 Roo.mailer.Column = function(config){
28     Roo.mailer.Column.superclass.constructor.call(this, config);
29 };
30
31 Roo.extend(Roo.mailer.Column, Roo.bootstrap.Component,  {
32     
33     
34     cls: '',
35     html : '',
36     src : '',
37     column : 'left',
38     width : '100%',
39      
40     getAutoCreate : function(){
41                                             
42         var tr = {
43             tag : 'tr',
44             cn : [ ]
45         };
46          
47        
48         
49         var cfg =   { 
50             tag: 'table',
51             border : 0,
52             cellpadding :20,
53             cellspacing : 0,
54             width : this.width,
55             cn :  []
56             
57         };
58         if (this.src != '') {
59             var img = {
60                 tag : 'img',
61                 src : this.src,
62                 cls : 'roo-m-column-image',
63                 
64                 style : 'max-width: ' + (this.width== '100%' ?  '260' : this.width ) +'px;'
65             };
66             if (this.width != '100%' ) {
67                 img.width = this.width;
68             }
69            cfg.cn.push({
70                 tag  : 'tr',
71                 cn : [
72                     {
73                         tag : 'td',
74                         align : 'center',
75                         valight : 'top',
76                         cls : 'roo-m-column-'+ this.column + '-content',
77                         cn : [ img ]
78                             
79                     }
80                 ]
81             });
82            
83         }
84         cfg.cn.push({
85              tag  : 'tr',
86              cn : [
87                  {
88                      tag : 'td',
89                      align : 'center',
90                      valight : 'top',
91                      cls : 'roo-m-column-'+ this.column + '-content roo-m-column-body',
92                      html : this.html
93                  }
94              ]
95          });
96            
97         
98         return cfg;
99     },
100     getChildContainer : function()
101     {
102         // add a child...
103         
104         return this.el.select('.roo-m-column-body',true).first();
105     }
106     
107     
108     
109     
110    
111 });
112
113  
114
115