{% load markup %}

<ol class="caseanswercontainer" type="A">
    {% for answer in question.answer_set.all %}
        {% if block.rhetorical %}
            <li class="{{answer.css_extra}}">
                <label>
                    <input name="question{{question.id}}" value="{{answer.label}}"
                           type="radio">
                    {{answer.label|safe}}
                </label>
            </li>
        {% else %}
            <li class="{{answer.css_extra}}">
                {% if response %}
                    <label>
                    <input name="pageblock-{{block.pageblock.id}}-question{{question.id}}"
                        value="{{answer.value}}" type="radio"
                        disabled="disabled"
                        {% ifequal response.value answer.value %}
                            class="yours {% if response.is_correct %}correct{% else %}incorrect{% endif %}"
                            checked="checked"
                        {% endifequal %}/> <span class="caseanswerlabel">{{answer.label|safe}}</span>
                    </label>
                    
                    <span class="caseanswerresult">
                        {% if response.is_correct %}
                            <span class="correct label label-success">Correct</span>
                        {% else %}
                            <span class="incorrect label label-danger">Incorrect</span>
                        {% endif %}
                    </span>

                    <div class="caseanswerexplanation">
                        {{answer.explanation|safe}}
                    </div>                          
                {% else %}
                    <label>
                        <input name="pageblock-{{block.pageblock.id}}-question{{question.id}}"
                               value="{{answer.value}}" type="radio">
                        <span class="caseanswerlabel">{{answer.label|safe}}</span>
                    </label>
                {% endif %}
            </li>
        {% endif %}
    {% endfor %}
</ol>


