JSFiddle - React, Tailwind, and code Playground
HTML
<script src="http://dev.sencha.com/deploy/ext-4.0.0/bootstrap.js"></script>
<link rel="stylesheet" href="http://dev.sencha.com/deploy/ext-4.0.0/resources/css/ext-all.css">
<div id="placeholder"></div>
CSS
.signature {
border: 1px solid black;
margin: 10px;
padding: 5px;
}
.signature a {
color: #505050;
text-decoration: none;
}
.signature a:hover {
color: black;
text-decoration: underline;
}
.signature .name {
font-size: 1.5em;
}
.signature .department{
font-size: 0.8em;
font-style: italic;
}
.signature .phone {
color: silver;
margin: 5px 0 0 5px;
}
.signature .phone .number {
color: black;
display: inline-block;
margin-right: 5px;
}
.signature .email {
color: silver;
margin: 5px 0 0 5px;
}
.signature .email .address {
color: gray;
display: inline-block;
margin-right: 5px;
}
/* dynamic content management */
.signature .phone:before { content: '#: '; }
.signature .email:before { content: '@: '; }
.signature .phone .number:after,
.signature .email .address:after { content: ','; }
.signature .phone .number.last:after,
.signature .email .address.last:after { content: ''; }
JavaScript
// define our template
var mySignatureTemplate = new Ext.XTemplate(
'<div class="signature">',
'<div class="name">{name}</div>',
'<div class="department">{department}</div>',
'<ul class="phone">',
'<tpl for="phoneNumbers">',
// notice this neat trick to see if this is the last element.. :)
'<li class="number{[xindex === xcount ? " last" : ""]}">{number} ({rel})</li>',
'</tpl>',
'</ul>',
'<ul class="email">',
'<tpl for="emailAddresses">',
'<li class="address{[xindex === xcount ? " last" : ""]}"><a href="mailto:{.}">{.}</a></li>',
'</tpl>',
'</ul>',
'</div>'
);
// overwrite placeholder contents
mySignatureTemplate.overwrite(Ext.get('placeholder'), {
name: 'Hans Doller',
department: 'Development',
phoneNumbers: [
{number:'555-111-2222',rel:'office'},
{number:'555-111-2223',rel:'cellular'},
{number:'555-111-2224',rel:'home'}
],
emailAddresses: [
'[email protected]',
'[email protected]'
]
});