{% extends "main.html" %}


{% block title %}Send Email{% endblock %}


{% block breadcrumbs %}
<div class="breadcrumbs">
    <a href='{% url "index" %}'>Home</a>&nbsp;›
    Send Email
</div>
{% endblock %}


{% block content %}
<div id="content-main">
    {% if emails %}
    <p>Email will be sent to {{ emails|length }} p{{ emails|pluralize:"erson,eople" }}.</p>

    {% if preview %}
    <div class="module">
        <h2>Preview of 1st email</h2>
        <p>To: {{ preview.3.0 }}</p>
        <hr />
        <p>From: {{ preview.2 }}</p>
        <hr />
        <p>Subject: {{ preview.0 }}</p>
        <hr />
        {{ preview.1|linebreaks }}
        {% endif %}
    </div>
    {% endif %}

    <div class="module">
        <h2>E-Mail</h2>
        <form method="post" action=".">{% csrf_token %}
            {% load forms %}
            <fieldset class="aligned ()">
                {% form_as_div form %}
            </fieldset>
            <p>Context:</p>
            <ul>
                <li>{% templatetag openvariable %} projects {% templatetag closevariable %} - All projects this person leads.</li>
                <li>{% templatetag openvariable %} receiver {% templatetag closevariable %} - This person.</li>
            </ul>
            <div class="submit-row">
                <input type="submit" name="preview" value="Preview" />
                {% if preview %}
                <input type="submit" value="Send" class="default" />
                {% endif %}
            </div>
        </form>
    </div>
</div>
{% endblock %}
