message-preview.html 2.38 KB
{% load i18n tz highlight %}

<li class="preview-message">
<span class="glyphicon glyphicon-{{ result.icon_name }}" title="{{ result.type }}"></span>

{% if result.tag %}
<a href="{% firstof result.mailinglist_url result.mailinglist.get_absolute_url result.url %}">
  <span class="label label-primary">{{ result.tag }}</span>
</a>
{% endif %}

{% if result.title %}
  <a href="{{ result.url }}{% if result.type == 'thread' and result.latest_message_pk %}#msg-{{ result.latest_message_pk }}{% elif result.type == 'thread' and result.pk %}#msg-{{ result.pk }}{% endif %}" {% if result.latest_description %}title="{{ result.latest_description|escape|truncatechars:150 }}"{% elif result.description %}title="{{ result.description|escape|truncatechars:150 }}"{% endif %}>
    <span class="subject">
      <!-- a striptags filter was raising an error here because using with highlight -->
      {% if query %}
        {% highlight result.title with query max_length "1000" %}
      {% else %}
        {{ result.title }}
      {% endif %}
    </span>
  </a>
{% endif %}

{% if result.description %}
      <!-- a striptags filter was raising an error here because using with highlight -->
  <span class="quiet">- {% if query %}
    {% highlight result.description with query max_length "150" %}
  {% else %}
    {% if result.latest_description %}
      {{ result.latest_description|striptags|escape|truncatechars:150 }}
    {% elif result.description %}
      {{ result.description|striptags|escape|truncatechars:150 }}
    {% endif %}
  {% endif %}
  </span>
{% endif %}

{% if result.fullname or result.modified or result.modified_by %}
  <div class="quiet">
    {% if result.modified_by %}
      <span class="pull-left">{% trans "by" %}
        {% if result.modified_by_url %}
          <a href="{{ result.modified_by_url }}">
        {% else %}
          <span>
        {% endif %}

        {% if query %}
          {% highlight result.modified_by with query %}
        {% else %}
          {{ result.modified_by }}
        {% endif %}

        {% if result.modified_by_url %}
          </a>
        {% else %}
          </span>
        {% endif %}
      </span>
    {% else %}
      <span class="pull-left">{% trans "by" %} {% trans "Anonymous" %}</span>
    {% endif %}
    {% if result.modified %}
      <span class="pull-right">{{ result.modified|localtime|timesince }} {% trans "ago" %}</span>
    {% endif %}
  </div>
{% endif %}
</li>