
{% extends "base.html" %}

{% block title %}{{ poll.name }}{% endblock %}

{% block page_title %}{{ poll.name }}{% endblock %}

{% block error %}
    {{error_msg}}
{% endblock %}

{% block content %}
    <p>
        {{poll.description}}
    </p>
    {% if not poll.page_set.count == 0 %}
        <form action="{% url polls.views.detail poll.id %}" method="post">
            {% csrf_token %}
            {% for question in questions %}
                <div class="question-set">
                    <div class="question-text">
                    {{ question.text }}
                    </div>
                    <div class="question-answers">
                        {% for answer in question.answer_set.all %}
                            <div style="width: 100%;float: left">
                                <input type="checkbox" name="{{ answer.id }}" value="{{ answer.id }}">
                                {{ answer.text }}
                                </input>
                            </div>
                        {% endfor %}
                    </div>
                </div>
            {% endfor %}
            <input type="hidden" name="current_page_index" value="{{ page_index }}" />
            {% if page_index != poll.page_set.count|add:"-1" %}
                <input type="hidden" name="next_page_index" value="{{ page_index|add:1 }}" />
                <input type="submit" name="next_page_link" value="Next" />
            {% else %}
                <input type="submit" name="result_page_link" value="Get results" />
            {% endif %}
        </form>
    {% endif %}

{% endblock %}