{% extends "base.html" %}
{% load i18n conversation_tags %}

{% block head_title %}{% trans "My conversations" %}{% endblock %}

{% block main %}
<div class="row">
    <div class="col-sm-4">
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">{% trans "My conversations" %}</h4>
            </div>
            {% if request.user.conversations.all %}
                <div class="list-group">
                    {% for conversation in request.user.conversations.all %}
                        {% if not request.user in conversation.archived_by.all %}
                            <a class="list-group-item conversation-link{% if conversation == object %} active{% endif %}{% if not request.user in conversation.read_by.all %} unread{% endif %}" href="{% url "conversation_update" pk=conversation.pk %}">
                                {% chain_user_names conversation.users.all request.user as user_names %}{{ user_names }}
                            </a>
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}
        </div>
    </div>
    <div class="col-md-8">
        {% block content %}{% endblock %}
    </div>
</div>
{% endblock %}