{% load i18n l10n %}
<table class="listing">
    <col width="10px" />
    <col />
    <col  />
    {% if collections %}
        <col />
    {% endif %}
    <col width="16%" />
    <thead>
        <tr class="table-headers">
            {% include 'wagtailadmin/bulk_actions/select_all_checkbox_cell.html' with parent=current_collection.id %}
            <th>
                {% if not is_searching %}
                    <a href="{% url 'wagtaildocs:index' %}{% if not ordering == "title" %}?ordering=title{% endif %}" class="icon icon-arrow-down-after {% if  ordering == "title" %}teal{% endif %}">
                        {% trans "Title" %}
                    </a>
                {% else %}
                    {% trans "Title" %}
                {% endif %}
            </th>
            <th>{% trans "File" %}</th>
            {% if collections %}
                <th>{% trans "Collection" %}</th>
            {% endif %}
            <th>
                {% if not is_searching %}
                    <a href="{% url 'wagtaildocs:index' %}{% if not ordering == "-created_at" %}?ordering=-created_at{% endif %}" class="icon icon-arrow-down-after {% if  ordering == "-created_at" %}teal{% endif %}">
                        {% trans "Created" %}
                    </a>
                {% else %}
                    {% trans "Created" %}
                {% endif %}
            </th>
        </tr>
    </thead>
    <tbody>
        {% trans "Select document" as checkbox_aria_label %}
        {% for doc in documents %}
            <tr>
                {% include "wagtailadmin/bulk_actions/listing_checkbox_cell.html" with obj_type="document" obj=doc aria_labelledby_prefix="document_" aria_labelledby=doc.pk|unlocalize aria_labelledby_suffix="_title" %}
                <td id="document_{{ doc.pk|unlocalize }}_title" class="title">
                    <div class="title-wrapper"><a href="{% url 'wagtaildocs:edit' doc.id %}{% if next %}?next={{ next|urlencode }}{% endif %}">{{ doc.title }}</a></div>
                </td>
                <td><a href="{{ doc.url }}" class="nolink" download>{{ doc.filename }}</a></td>
                {% if collections %}
                    <td>{{ doc.collection.name }}</td>
                {% endif %}
                <td>
                    <div class="human-readable-date" title="{{ doc.created_at|date:"DATETIME_FORMAT" }}">
                        {% blocktrans trimmed with time_period=doc.created_at|timesince %}{{ time_period }} ago{% endblocktrans %}
                    </div>
                </td>
            </tr>
        {% endfor %}
    </tbody>
</table>
