{% load bootstrap3 %}
{% load i18n %}

{% include 'editor/fragment_levels.html' %}

<h3>
    {{ model_title_plural }}
    {% if space %}
        {% with space.title as space_title %}
            <small>{% blocktrans %}in space {{ space_title }}{% endblocktrans %}</small>
        {% endwith %}
    {% elif level %}
        {% with level.title as level_title %}
            <small>{% blocktrans %}on level {{ level_title }}{% endblocktrans %}</small>
        {% endwith %}
    {% endif %}
</h3>
{% bootstrap_messages %}
{% if can_create %}
    <a class="btn btn-default btn-xs" accesskey="n" href="{{ create_url }}">
        <i class="glyphicon glyphicon-plus"></i> {% blocktrans %}New {{ model_title }}{% endblocktrans %}
    </a>
{% endif %}

{% if explicit_edit %}
    {% trans 'Details' as edit_caption %}
{% else %}
    {% trans 'Edit' as edit_caption %}
{% endif %}

<table class="table table-condensed itemtable" data-nozoom data-list="{{ model_name }}">
    <tbody>
        {% for objects in grouped_objects %}
            {% if objects.title %}
                <tr class="item-group-header">
                    <td>{{ objects.title }}</td>
                    {% for col in add_cols %}<td></td>{% endfor %}
                    <td></td>
                </tr>
            {% endif %}
            {% for item in objects.objects %}
                {% if forloop.counter0|divisibleby:10 %}
                    <tr>
                        <td><a href="{{ back_url }}" data-no-next-zoom>&laquo; {{ back_title }}</a></td>
                        {% for col in add_cols %}<td></td>{% endfor %}
                        <td></td>
                    </tr>
                {% endif %}
                <tr data-pk="{{ item.pk }}">
                    <td>{{ item.title }}</td>
                    {% for col in item.add_cols %}<td>{{ col }}</td>{% endfor %}
                    <td><a href="{{ item.edit_url }}">{{ edit_caption }}</a></td>
                </tr>
            {% endfor %}
        {% endfor %}
        <tr>
            <td><a href="{{ back_url }}" data-no-next-zoom>&laquo; {{ back_title }}</a></td>
            {% for col in add_cols %}<td></td>{% endfor %}
            <td></td>
        </tr>
    </tbody>
</table>
