{% load i18n misago_batch misago_capture %}
<div class="post-attachments">
  {% for row in post.attachments|batch:2 %}
    <div class="row">
      {% for attachment in row %}
        <div class="col-xs-12 col-md-6">
          <div class="post-attachment-preview">
            {% if attachment.is_image %}
              {% if attachment.url.thumb %}
                <a href="{{ attachment.url.index }}" target="_blank" class="post-thumbnail" style='background-image: url("{{ attachment.url.thumb }}")'></a>
              {% else %}
                <a href="{{ attachment.url.index }}" target="_blank" class="post-thumbnail" style='background-image: url("{{ attachment.url.index }}")'></a>
              {% endif %}
            {% else %}
              <a href="{{ attachment.url.index }}" target="_blank" class="material-icon">
                insert_drive_file
              </a>
            {% endif %}
          </div>
          <div class="post-attachment">
            <a href="{{ attachment.url.index }}" target="_blank" class="attachment-name item-title">{{ attachment.filename }}</a>
            <p class="post-attachment-description">
              {% capture trimmed as uploader %}
                {% if attachment.url.uploader %}
                  <a href="{{ attachment.url.uploader }}" class="item-title">{{ attachment.uploader_name }}</a>
                {% else %}
                  <span class="item-title">{{ attachment.uploader_name }}</span>
                {% endif %}
              {% endcapture %}
              {% capture trimmed as uploaded_on %}
                <abbr title="{{ attachment.uploaded_on }}">{{ attachment.uploaded_on|date }}</abbr>
              {% endcapture %}
              {% blocktrans trimmed with filetype=attachment.filetype size=attachment.size|filesizeformat uploader=uploader|safe uploaded_on=uploaded_on|safe context "post attachment" %}
                {{ filetype }}, {{ size }}, uploaded by {{ uploader }} on {{ uploaded_on }}.
              {% endblocktrans %}
            </p>
          </div>
        </div>
      {% endfor %}
    </div>
  {% endfor %}
</div>