{% extends 'speeches/base.html' %}
{% load i18n %}
{% load staticfiles %}
{% load compressed %}
{% load url from future %}
{% load django_select2_tags %}

{% block extra_css %}
{% import_django_select2_css 1 %}
{{ block.super }}
{# <link rel="stylesheet" href="{% static "css/bootstrap-datepicker.css" %}" /> #}
{% endblock %}

{% block extra_js %}
{{ block.super }}
{% import_django_select2_js 1 %}
{% compressed_js 'sayit-upload' %}
{% endblock %}

{% block title %}{% if object %}{% trans "Edit speech" %} {% else %}{% trans "Add speech" %}{% endif %}{% endblock %}

{% block content %}

{% if added %}
<div class="alert alert-success"> 
    Your speech has been <a href="{% url "speeches:speech-view" added %}">created</a>
    in the section <a href="{% url "speeches:section-view" section.get_path %}#s{{ added }}">{{ section.title }}</a>!
</div>
{% endif %}

<p class="lead {% if object %}edit{% else %}add{% endif %}-speech">
    {% if object %}
        {% trans "Here is where you can edit a speech." %}
    {% else %}
        {% trans "Here is where you can add a new speech." %}
    {% endif %}
</p>

<form id="speech-form" class="form-horizontal{% if not object and not form.non_field_errors %} {% endif %}" method="post" enctype="multipart/form-data">
    {% if object %}
        {% include 'speeches/form.html' with type="speech" submit="Update speech" %}
    {% else %}
        {% include 'speeches/form.html' with type="speech" submit="Add speech" pre_submit_name="add_another" pre_submit_text="Save and add another speech" %}
    {% endif %}
</form>

{% endblock %}
