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


{% block user_profile_content %}

    {% if subscriptions %}
    <table class="table table-bordered table-sm subscriptions d-md-none">
        <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>
                    <span class="likestatus">
                        <i class="fa fa-thumbs-o-up"  aria-label="likes"></i> {{ sub.likes }} 
                        <i class="fa fa-thumbs-o-down" aria-label="dislikes"></i> {{ 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 subscriptions table-sm d-none d-md-table">
        <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>
                    <span class="likestatus">
                        <i class="fa fa-thumbs-o-up"></i> {{ sub.likes }} 
                        <i class="fa fa-thumbs-o-down"></i> {{ 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 %}
