{% extends 'niji/base.html' %}
{% load i18n %}
{% load niji_tags %}
{% load humanize %}

{% block left %}
    <div class="panel panel-default">
        <div class="panel-body panel-subtitle">
            <span class="label label-success">{% trans "Notifications" %}</span>
        </div>
        <!-- List group -->
        <ul class="list-group topic-list">
            {% for notification in notifications %}
                <li class="list-group-item notification-entry">
                    <div class="row">
                        <div class="col-xs-3">
                            <img src="{% avatar_url notification.sender 28 %}">
                        </div>
                        <div class="col-xs-9">
                            <div class="notification-meta">
                                {% url 'niji:user_info' notification.sender_id as user_url %}
                                {% if notification.topic %}
                                    {% url 'niji:topic' notification.topic_id as topic_url %}
                                    {%blocktrans with username=notification.sender.username topic_title=notification.topic.title%}
                                        <a href="{{ user_url }}">
                                            {{ username }}
                                        </a>
                                        mentioned you in topic
                                        <a href="{{ topic_url }}">
                                            {{ topic_title }}
                                        </a>
                                    {% endblocktrans %}
                                {% else %}
                                    {% url 'niji:topic' notification.post.topic_id as topic_url %}
                                    {% blocktrans with username=notification.sender.username topic_title=notification.post.topic.title%}
                                        <a href="{{ user_url }}">
                                            {{ username }}
                                        </a>
                                        mentioned you when replying to
                                        <a href="{{ topic_url }}">
                                            {{ topic_title }}
                                        </a>
                                    {% endblocktrans %}
                                {% endif %}
                            </div>
                            <div class="notification-content">
                                {% if notification.topic_id %}
                                    {{ notification.topic.content_rendered | safe | truncatewords_html:30 }}
                                {% endif %}
                                {% if notification.post_id %}
                                    {{ notification.post.content_rendered | safe | truncatewords_html:30 }}
                                {% endif %}
                            </div>
                        </div>
                    </div>
                </li>
            {% endfor %}
        </ul>
        <div class="panel-footer">
            {% get_pagination %}
        </div>
    </div>
{% endblock %}