Commit d93375bc by solashirai Committed by Piotr Mitros

attempt at mustache minimal example

parent abae7d6c
......@@ -26,9 +26,9 @@
</div>
</script>
<script id="personTpl" type="text/template">
<script id="testingID" type="x-tmpl-mustache">
<h1>{{firstName}} {{lastName}}</h1>
<p>Blog URL: <a href="{{blogURL}}">{{blogURL}}</a></p>
<p>Test <a href="{{testvar}}">{{testvar}}</a></p>
</script>
<script type="x-tmpl-mustache" id="show_answer_feedback">
......
......@@ -18,16 +18,18 @@ function CrowdsourceHinter(runtime, element){
Logger.listen('seq_prev', null, stopScript);
Logger.listen('seq_goto', null, stopScript);
//read the data from the problem_graded event here
//data about the problem obtained from Logger.listen('problem_graded') is passed on to the onStudentSubmission.
//directly passing data to onStudentSubmission does not work for unknown reasons (to be fixed?)
function get_event_data(event_type, data, element){
console.log("is this changing");
/*below is minimal mustache template usage attempt
$.get('crowdsourcehinter.html', function(data) {
var template = $('#personTpl').html();
var html = Mustache.to_html(template, data);
$('#sampleArea').html(html);
});
*/
//below is minimal mustache template usage attempt
var data = {
firstName: "Sola",
lastName: "Shirai",
testvar: "Hello"
};
var template = $(Mustache.render($("#testingID").html(), data));
$('#sampleArea').html(template);
onStudentSubmission(data);
}
Logger.listen('problem_graded', null, get_event_data);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment