{% extends postorius_base_template %}
{% load i18n %}
{% load bootstrap_tags %}
{% load nav_helpers %}

{% block subtitle %}
{% trans 'Info' %} | {{ list.fqdn_listname }}
{% endblock %}

{% block main %}

    {% list_nav 'list_summary' 'Summary' %}

    <p>{{ list.settings.description }}</p>
    <p>{% trans 'To contact the list owners, use the following email address:' %} <em>{{ list.settings.owner_address }}</em></p>

    {# Archives #}
    {% if hyperkitty_url %}
        {% url 'hk_list_overview' list.fqdn_listname as hyperkitty_list_url %}
        {% blocktrans %}
          <p>To see the prior postings to this list, visit
          <a href="{{ hyperkitty_list_url }}">the archives</a>.</p>
        {% endblocktrans %}
    {% endif %}

    <hr />

    {# Subscription #}
    {% if user.is_authenticated %}
        {% if userSubscribed %}
            <h2>{% trans 'Subscription' %}</h2>
            <p>
                {% trans 'You are subscribed to this list with the following address:' %} <em>{{ subscribed_address }}</em>
            </p>
            {% url 'user_list_options' list.list_id as user_list_options_url %}
            {% blocktrans %}
            <p>
              You can manage your subscription <a href="{{ user_list_options_url }}">here</a>
            </p>
            {% endblocktrans %}
            <p>
                <form method="post" action="{% url 'list_unsubscribe' list.list_id %}">
                    {% csrf_token %}
                    <input type="hidden" name="email" value="{{ subscribed_address }}" />
                    <button type="submit" class="btn btn-danger">{% trans 'Unsubscribe' %}</button>
                </form>
            </p>
        {% else %}
            <h2>{% trans 'Subscribe to this list' %}</h2>
            <form action="{% url 'list_subscribe' list.list_id %}" method="post" class="form-horizontal">
                {% render_form_horizontal subscribe_form 2 8 'Subscribe' %}
            </form>
        {% endif %}
    {% else %}
        <p>{% trans 'If you want to subscribe to this list, you have to log in first.' %}</p>
        <p><a href="{{ login_url }}?next={{ next|default:request.path|urlencode }}" class="btn btn-primary">{% trans 'Log In' %}</a></p>
    {% endif %}

    {# List metrics #}
    {% if user.is_authenticated %}
        {% if user.is_list_owner or user.is_superuser %}
            <hr />
            <h4>{% trans 'List metrics' %}</h4>
            <dl class="dl-horizontal">
              <dt>{% trans 'Created at' %}</dt><dd>{{ list.settings.created_at }}</dd>
              <dt>{% trans 'Last post at' %}</dt><dd>{{ list.settings.last_post_at }}</dd>
              <dt>{% trans 'Digest last sent at' %}</dt><dd>{{ list.settings.digest_last_sent_at }}</dd>
              <dt>{% trans 'Volume' %}</dt><dd>{{ list.settings.volume }}</dd>
            </dl>
        {% endif %}
    {% endif %}
{% endblock %}
