<div class="container">
  {% include 'messages/menu' %}


  <div class="page-header">
    <h1>Messages <small>Inbox</small></h1>
  </div>

  <table class="table table-striped">
    <thead>
      <tr>
        <th>From</th>
        <th>Subject</th>
        <th>Sent</th>
        <th></th>
      </tr>
    </thead>
    <tbody>
        {% if messages.size > 0 %}
          {% for message in messages %}
             <tr class="{{ message.state }}">
               <td>
                {% if message.sender == present %}
                  {{ message.sender }}
                {% else %}
                  <span class="deleted">(user deleted)</span>
                {% endif %}
              </td>
              <td>{{ message.subject | link_to: message.url }}</td>
              <td>{{ message.created_at }}</td>
              <td>{{ 'Delete' | delete_button: message.url, class: 'btn btn-danger btn-sm' }}</td>
            </tr>
         {% endfor %}
        {% else %}
          <tr>
            <td colspan="4"><center>You have not received any messages.</center></td>
          </tr>
        {% endif %}
    </tbody>
  </table>

  {% include 'shared/pagination' %}
</div>
