{% extends "contact/base.html" %}
{% load cache typogrify_tags markup comments %}

{% block bodyid %}messagelist{% endblock %}

{% block title %}
    {{ controller }} Messages
    {% if page_obj.number != 1 %}Page {{ page_obj.number }} {% endif %}
{% endblock %}

{% block content %}
    {% cache 500 'message_list' page_obj.number site.id 1 %}
      <div class="columned two-col">
        {% for message in message_list %}
          <article>
            <h1>
              <a href="{{ message.get_absolute_url }}">
                {{ message.sender_name }}
              </a>
            </h1>
            <p>
              {% if message.contact_city or message.contact_state %}
                <b class="city">
                  {{ message.contact_city }}
                  {% if message.contact_city and message.contact_state %},{% endif %} 
                  {{ message.contact_state }}
                </b> &ndash; 
              {% endif %}
              <q>{{ message.body|truncatewords:"32" }}</q>
            </p>
          </article>
        {% endfor %}
      </div>
    {% endcache %}

    {% include 'includes/generic_pagination.html' %}
{% endblock %}
