{% extends "oneevent/base.html" %}
{% load crispy_forms_tags %}
{% load crispy_forms_field %}

{% block navbar_header_text %}{% if choice.id %}Edit{% else %}New{% endif %} Choice{% endblock %}

{% block heading_action %}{% if choice.id %}Edit{% else %}New{% endif %} Choice{% endblock %}

{% block heading_title %}{{ choice.event.title }}
    <small>{{ choice.event.start|date:"D, d N Y H:i" }}</small>
{% endblock %}

{% block content %}
<div class="row">
    <form method="post" class="form-horizontal"
    {% if choice.id %}
        action="{% url 'choice_update' choice_id=choice.id %}">
    {% else %}
        action="{% url 'choice_create' event_id=choice.event.id %}">
    {% endif %}

        <p>{% crispy choice_form %}</p>

        <div class="panel panel-warning collapsible-caret">
            <div class="panel-heading collapsible-toggle collapsed"
                data-toggle="collapse" data-target="#collapseOne">
                Help
            </div>
            <div class="panel-body panel-collapse collapse" id="collapseOne">
                <ul>
                    <li>You must always have one (and only one) <strong>Default</strong>
                        Option for your choice</li>
                    <li>If you delete an Option, all participants who had selected this Option will
                        have the <strong>Default</strong> Option selected instead</li>
                    <li>When you create a new Choice, the <strong>Default</strong> Option will be
                        selected for all participants</li>
                    <li>If you want to add more than {{ options_formset.extra }} options, just
                        save the choice and "edit the choice.</li>
                </ul>
            </div>
        </div>

        {% crispy options_formset options_helper %}
    </form>
</div>
{% endblock %}