{% extends postorius_base_template %}
{% load url from future %}
{% load i18n %}
{% load nav_helpers %}

{% block body_class %}list_summary{% endblock %}

{% block main %}
    {% if user.is_superuser %}
        {% include 'postorius/menu/list_nav.html' %}
    {% endif %}
    <h1>{{list.display_name}}</h1>


    <h2>{% trans 'Description' %}</h2>
    <p>{{list.settings.description }}</p>
  
    {% if user.is_authenticated %}
    {% if userSubscribed %}
    <a href="{% url 'list_unsubscribe' list.list_id user.email %}" class="btn btn-danger">{% trans "Unsubscribe" %}</a>
    {% else %}
    <h2>{% trans 'Subscribe to this list' %}</h2>
    <form action="{% url 'list_subscribe' list.list_id %}" method="post" class="list_subscribe"> {% csrf_token %}
        {{subscribe_form.as_p}}
        <input class="btn btn-success" type="submit" value="{% trans 'Subscribe' %}" />
    </form>
    {% endif %}
    {% else %}
        <p>{% trans "To subscribe to or unsubscribe from this list you have to be logged in." %}</p>
        <p><a href="{% url 'user_login' %}"class="btn btn-primary">{% trans "Log In" %}</a></p>
    {% endif %}
{% endblock %}
