mailing.jinja 1.93 KB
Newer Older
Sli's avatar
Sli committed
1 2 3 4 5 6 7 8 9 10
{% extends "core/base.jinja" %}

{% block title %}
{% trans %}Mailing lists{% endtrans %}
{% endblock %}

{% block content %}
    {% if has_objects %}

    {% for mailing in object_list %}
Sli's avatar
Sli committed
11 12
    <h2>{% trans %}Mailing{% endtrans %} {{ mailing.email }} 
        {%- if user.is_owner(mailing) -%}
Sli's avatar
Sli committed
13
        <a href="{{ url('club:mailing_delete', mailing_id=mailing.id) }}"> - {% trans %}Delete{% endtrans %}</a>
Sli's avatar
Sli committed
14 15 16
        {%- endif -%}
    </h2>
    <hr>
Sli's avatar
Sli committed
17 18 19
    <table>
        <tr>
            <th>{% trans %}User{% endtrans %}</th>
Sli's avatar
Sli committed
20
            <th colspan="2">{% trans %}Email{%endtrans%}</th>
Sli's avatar
Sli committed
21 22 23 24 25 26 27 28 29
        </tr>
        {% for subscriber in mailing.subscriptions.all() %}
        <tr>
            {% if subscriber.user %}
            <td>{{ subscriber.user }}</td>
            {% else %}
            <td>{% trans %}Unregistered user{% endtrans %}</td>
            {% endif %}
            <td>{{ subscriber.email }}</td>
Sli's avatar
Sli committed
30
            <td><a href="{{ url('club:mailing_subscription_delete', mailing_subscription_id=subscriber.id) }}">{% trans %}Delete{% endtrans %}</a></td>
Sli's avatar
Sli committed
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
        </tr>
        {% endfor %}
    </table>
    {% endfor %}

    {% else %}
    <p>{% trans %}No mailing list existing for this club{% endtrans %}</p>
    {% endif %}

    {% if has_objects %}
        <h2>{% trans %}New member{% endtrans %}</h2>
        <form action="{{ url('club:mailing_subscription_create', club_id=club.id) }}" method="post" enctype="multipart/form-data">
            {% csrf_token %}
            {{ new_member.as_p() }}
            <p><input type="submit" value="{% trans %}Add to mailing list{% endtrans %}" /></p>
        </form>
    {% endif %}

    <h2>{% trans %}New mailing{% endtrans %}</h2>
    <form action="{{ url('club:mailing_create', club_id=club.id) }}" method="post" enctype="multipart/form-data">
        {% csrf_token %}
        {{ new_mailing.as_p() }}
        <p><input type="submit" value="{% trans %}Create mailing list{% endtrans %}" /></p>
    </form>

{% endblock %}