roojs-core.js
[roojs1] / Roo / mailer / Block.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.Block 
14  * @extends Roo.bootstrap.Component
15  * Bootstrap Element class
16  * @cfg {String} cls class of the element
17  * @cfg {String} html content of header (not used for columns)
18  * @cfg {String} blocktype  (header|preheader|footer|body|row)
19  * 
20  * @constructor
21  * Create a new Element
22  * @param {Object} config The config object
23  */
24
25 Roo.mailer.Block = function(config){
26     Roo.mailer.Block.superclass.constructor.call(this, config);
27 };
28
29 Roo.extend(Roo.mailer.Block, Roo.bootstrap.Component,  {
30     
31     
32     cls: '',
33     html : '',
34     blocktype :   'header',
35      
36     getAutoCreate : function(){
37                                             
38         var tr = {
39             tag : 'tr',
40             cls : 'roo-m-block-tr'
41         };
42         if (this.blocktype != 'row') {
43             tr.cn = [
44                 {
45                     tag : 'td',
46                     align : 'center',
47                     valight : 'top',
48                     cls : 'roo-m-' + this.blocktype + '-content',
49                     html : this.html
50                 }
51             ];
52         }
53         
54         var cfg =   {
55             tag: 'table',
56             border : 0,
57             cellpadding : 0,
58             cellspacing : 0,
59             width : '100%',
60             align : 'center',
61             cls: 'roo-m-' + this.blocktype + ' ' + this.cls,
62             
63             cn : [ tr ]
64             
65         };
66  
67         
68         return cfg;
69     },
70     getChildContainer : function(build_call)
71     {
72         // add a child...
73         if (this.blocktype == 'row' && build_call) {
74             var par = this.el.select(
75                         '.roo-m-block-tr',true
76                     ).first();
77             return par.createChild( {    
78                     tag:  'td',
79                     align : 'center',
80                     valign : 'top',
81                     style : 'padding-top : 20px;',
82                     cls : 'roo-m-column'
83                 }
84           
85             );
86         }
87         
88         return this.el.select('.roo-m-' + this.blocktype + '-content',true).first();
89     }
90     
91     
92     
93     
94    
95 });
96
97  
98
99