Skip to content

Instantly share code, notes, and snippets.

@DanielCoulbourne
Created October 9, 2015 16:44
Show Gist options
  • Save DanielCoulbourne/c09c3f1791e33188c08f to your computer and use it in GitHub Desktop.
Save DanielCoulbourne/c09c3f1791e33188c08f to your computer and use it in GitHub Desktop.
{% for the_quiz in post.quiz %}
{% set quiz_obj = TimberPost(the_quiz) %}
<h3>Take the {{quiz_obj.title}} Quiz</h3>
{% for the_question in quiz_obj.get_field('question') %}
{% if loop.index is even %}
<div class="row">
{% endif %}
<div class="col-md-6">
<p><span>{{loop.index}}.</span>{{the_question.question}}</p>
<form>
{% for answer in the_question.answer %}
<input id="{{answer_text|sanitize}}{{loop.index}}" type="checkbox" name="answer" class="correct_{{answer.correct}}"></input>
<label for="{{answer_text|sanitize}}{{loop.index}}">{{answer.answer_text}}</label><br/>
{% endfor %}
</form>
</div>
{% if loop.index is even %}
</div>
{% endif %}
{% endfor %}
{% endfor %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment