Skip to content

Instantly share code, notes, and snippets.

@pure
Created June 11, 2012 16:08
Show Gist options
  • Save pure/2910893 to your computer and use it in GitHub Desktop.
Save pure/2910893 to your computer and use it in GitHub Desktop.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title></title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script src="http://github.com/pure/pure/raw/master/libs/pure.js"></script>
</head>
<body>
<div id="test">
<div class="qa">
<h3 class="question"></h3>
<div class="answer"></div>
</div>
</div>
<script>
var data = {
questions:[
{id:1, text:'How do I order a title I want to rent?'},
{id:0, text:'I\'ve registered, but how do I start getting rental discs sent out to me?'},
{id:2, text:'How many discs can I have at home at any one time and how much does it cost?'}
],
answers:{
'0':'Look at your postbox',
'1':'just ask',
'2':'as many as you pay for'
}
},
dir = {
'.qa':{
'question<-questions':{
'.question':'question.text',
'.answer':function(a){
return a.context.answers[this.id];
}
}
}
};
$('#test').render(data, dir);
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment