Skip to content

Instantly share code, notes, and snippets.

@tauren
Created February 10, 2012 01:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tauren/1784972 to your computer and use it in GitHub Desktop.
Save tauren/1784972 to your computer and use it in GitHub Desktop.
var html = $('script#todo').html();
var data = {
content: 'Todo item',
done: false
};
var map = Plates.Map();
map.class('todo-content').to('content');
// TODO: Add mapping to render checkbox properly
// map setting to make the following render if done = true:
// <input type="checkbox" checked="checked" />
// Or this if done = false:
// <input type="checkbox" />
console.log(Plates.bind(html, data, map));
<script type="text/x-plates-tmpl" id="todo">
<div class="todo">
<div class="display">
<input class="check" type="checkbox" />
<div class="todo-content"></div>
<span class="todo-destroy"></span>
</div>
<div class="edit">
<input class="todo-input" type="text" value="" />
</div>
</div>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment