{% extends "hyperkitty/user_profile/base.html" %}
{% load i18n %}
{% load hk_generic %}


{% block user_profile_content %}

    {% if subscriptions %}
    <table class="table table-bordered table-condensed subscriptions hidden-sm hidden-md hidden-lg">
        <tbody>
        {% for sub in subscriptions %}
            {% ifchanged sub.list_name %}
            <tr class="list-address">
                <td><a href="{% url 'hk_list_overview' mlist_fqdn=sub.list_name %}">{{ sub.list_name }}</a></td>
            </tr>
            {% endifchanged %}
            <tr>
                {% if sub.first_post %}
                <td>
                    <a href="{% url 'hk_message_index' mlist_fqdn=sub.list_name message_id_hash=sub.first_post.message_id_hash %}"
                        >{{ sub.first_post.subject }}</a>
                    <br>
                    <abbr title="{{ sub.first_post.date|date:'D, j M Y H:i'|escape }}">
                    {{ sub.first_post.date|timesince }}</abbr> {% trans "since first post" %}
                    <br>
                    <a href="{{ sub.all_posts_url }}">{{ sub.posts_count }} {% trans "post" %}{{ sub.posts_count|pluralize }}</a>
                    <br>
                    <i class="icomoon likestatus {{ sub.likestatus }}"></i>
                    <span class="likestatus">+{{ sub.likes }}/-{{ sub.dislikes }}</span>
                {% else %}
                <td colspan="4" style="text-align:center"><em>{% trans "no post yet" %}</em>
                {% endif %}
                </td>
            </tr>
        {% endfor %}
        </tbody>
    </table>
    <table class="table table-striped table-bordered table-condensed subscriptions hidden-tn hidden-xs">
        <thead>
            <tr>
                <th>{% trans "List" %}</th>
                <th>{% trans "Time since the first activity" %}</th>
                <th>{% trans "First post" %}</th>
                <th>{% trans "Posts to this list" %}</th>
                <th>{% trans "Votes" %}</th>
            </tr>
        </thead>
        <tbody>
        {% for sub in subscriptions %}
            <tr>
                <td>
                    <a href="{% url 'hk_list_overview' mlist_fqdn=sub.list_name %}">{{ sub.list_name }}</a>
                </td>
                {% if sub.first_post %}
                <td>
                    <abbr title="{{ sub.first_post.date|date:'l, j F Y H:i:s'|escape }}">
                    {{ sub.first_post.date|timesince }}</abbr>
                </td>
                <td>
                    <a href="{% url 'hk_message_index' mlist_fqdn=sub.list_name message_id_hash=sub.first_post.message_id_hash %}"
                        >{{ sub.first_post.subject }}</a>
                </td>
                <td><a href="{{ sub.all_posts_url }}">{{ sub.posts_count }} {% trans "post" %}{{ sub.posts_count|pluralize }}</a></td>
                <td>
                    <i class="icomoon likestatus {{ sub.likestatus }}"></i>
                    <span class="likestatus">+{{ sub.likes }}/-{{ sub.dislikes }}</span>
                </td>
                {% else %}
                <td colspan="4" style="text-align:center"><em>{% trans "no post yet" %}</em></td>
                {% endif %}
            </tr>
        {% endfor %}
        </tbody>
    </table>
    {% else %}
    <p><em>{% trans "no subscriptions" %}</em></p>
    {% endif %}

{% endblock %}
