{% extends "message/message_layout.html" %}
{% block message_content %}
<table class="table table-bordered">
    <thead>
        <tr>
            <th>From</th>
            <th>Subject</th>
            <th>Date</th>
            <th>Options</th>
        </tr>
    </thead>
    <tbody>
        {% for message in messages %}
        <tr>
        {% if message.from_user %}
            <td><a href="{{ url_for('user.profile', username=message.from_user.username) }}">{{ message.from_user.username }}</a></td>
        {% else %}
            <td>[deleted]</td>
        {% endif %}
            <td><a href="{{ url_for('user.view_message', id=message.id) }}">{{ message.subject }}</a></td>
            <td>{{ message.date_created|time_since }}</td>
            <td><a href="{{ url_for('user.delete_message', id=message.id) }}">Delete</a> |
                <a href="{{ url_for('user.move_message', id=message.id) }}">Move</a></td>
        </tr>
        {% else %}
        <tr>
            <td colspan="4">
                This message folder is empty.
            </td>
        </tr>
        {% endfor %}
    </tbody>
</table>
{% endblock %}
