{% load sekizai_tags markup %}
{% load i18n %}

{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}js/libs/underscore-1.3.1.min.js"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}js/libs/json2.js"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}js/libs/backbone-0.9.1.min.js"></script>{% endaddtoblock %}
{% addtoblock "js" %}<script type="text/javascript" src="{{ STATIC_URL }}js/saq.js"></script>{% endaddtoblock %}
{% addtoblock "js" %}
<script type="text/javascript">
    $(function () {
        var model = new SAQ.Question({
            slug: '{{ question.slug }}'
        });
        var view = new SAQ.MultiChoiceQuestionView({
            el: $('#saq-question-multi-{{ question.slug }}')[0],
            model: model
        });
        SAQ.questions.add(model);
    });
</script>
{% endaddtoblock %}

<div class="saq-question-container saq-question-multi-container {{ question.slug }}-container"
{% if not triggered %} style="display:none;" {% endif %}
{% if depends_on %}data-dependency="{{ depends_on }}"{% endif %}
>
{% if question.label %}
<div>
    <label class="saq-question-label" for="saq-question-multi-{{ question.slug }}">{% trans question.label %}</label>
    <span class="saq-question-help-text">{% if question.help_text %}{% trans question.help_text %}{% endif %}</span>
</div>
{% endif %}
<ul class="saq-question saq-question-multi" id="saq-question-multi-{{ question.slug }}">
    <li class="saq-question-error"></li>
    {% for answer in answers %}
    <li class='saq-answer saq-answer-multi'>
        <input type="checkbox" id="saq-answer-multi-{{ answer.pk }}" name="{{ question.slug }}" value="{{ answer.slug }}" {% if submission and answer.slug in submission.answer_list %}checked{% endif %}>
        <label for="saq-answer-multi-{{ answer.pk }}">
            <div class="saq-answer-title">{% trans answer.title %}</div>
            <div class="saq-answer-help-text">
                {% if answer.help_text %}{% trans answer.help_text|markdown %}{% endif %}
            </div>
        </label>
    </li>
    {% endfor %}
</ul>
</div>
{# vim: set filetype=htmldjango: #}
