Newer
Older
postorius / src / postorius / templates / postorius / user / subscription_preferences.html
{% extends postorius_base_template %}
{% load i18n %}
{% load bootstrap_tags %}
{% load nav_helpers %}

{% block subtitle %}
{% trans 'Subscription preferences' %} | {{ user.username }}
{% endblock %}

{% block main %}

    {% user_nav 'settings' 'Subscription settings' %}

    <ul class="nav nav-tabs margin-bottom">
     <li> <a href="{% url 'user_mailmansettings' %}">{% trans 'Global Mailman preferences' %}</a></li>
     <li> <a href="{% url 'user_address_preferences' %}">{% trans 'Address-based preferences' %}</a></li>
     <li class="active"><a href="#">{% trans 'Subscription-based preferences' %}</a></li>
    </ul>
    {% if not zipped_data or nolists %}
      <div>
          <h4>{% trans 'No preferences available' %}</h4>
      </div>
      <p>{% trans 'You are not yet subscribed to any lists, so you have no Mailman preferences.' %}</p>
    {% else %}
        <p>{% trans 'Each list subscription can have specific Mailman preferences.' %}</p>
        <form action="{% url 'user_subscription_preferences' %}" method="post" id="subscriptions_formset">
            {% csrf_token %}
            {{ formset.management_form }}
            <div class="table-responsive">
                <table class="table table-striped table-bordered">
                    {% for form, subscription in zipped_data %}
                        {% if forloop.first %}
                            <thead>
                                <tr>
                                    <th>{% trans 'Subscription' %}</th>
                                    {% for field in form.visible_fields %}
                                    <th>
                                        <label for="{{ field.id_for_label }}"><a data-toggle="tooltip" title="{{ field.help_text }}">{{ field.label }}</a></label>
                                    </th>
                                    {% endfor %}
                                </tr >
                            </thead >
                        {% endif %}
                        <tr id="{{subscription.list_id}}">
                            <td>{{ subscription.list_id }}</td>
                            {% for field in form %}
                                {% if field|fieldtype == 'RadioSelect' %}
                                    <td class="text-center">
                                    {% for choice in field %}
                                        <label class="radio-inline">
                                            {{ choice.tag }}
                                            {{ choice.choice_label }}
                                        </label>
                                    {% endfor %}
                                    </td>
                                {% else %}
                                    <td>{{ field|add_form_control }}</td>
                            {% endif %}
                            {% endfor %}
                        </tr>
                    {% endfor %}
                </table>
            </div>
            <div class="text-center">
                <button class="btn btn-primary" type="submit">{% trans 'Save' %}</button>
            </div>
        </form>
    {% endif %}

{% endblock main %}
{% block additionaljs %}
<script>
    $(function () {
        $('[data-toggle="tooltip"]').tooltip()
    })
</script>
{% endblock %}