Skip to content

Instantly share code, notes, and snippets.

@tauren
Created January 31, 2012 01:05
Show Gist options
  • Save tauren/1707961 to your computer and use it in GitHub Desktop.
Save tauren/1707961 to your computer and use it in GitHub Desktop.
renderTemplate: function(model, extras) {
var json = {
'orders': [
{'id':'o12345','status':'Shipped','ordered':'2011-06-01'},
{'id':'o34567','status':'Pending','ordered':'2011-07-01'},
{'id':'o56789','status':'Shipped','ordered':'2011-08-01'}
]
};
var tmpl = 'script#ordersTmpl';
var html = Plates.bind($(tmpl).html(), json);
return html;
}
<div id="orders">
Order List goes here...
</div>
<script type="text/x-template" id="ordersTmpl">
<table>
<tr class="orders">
<td class="id">Order Id</td>
<td class="ordered">2011-10-20</td>
<td class="status">status</td>
<td class="actions"><a href="#" class="button">Order Again</a></td>
</tr>
</table>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment