{% load jmbo_template_tags jmbo_inclusion_tags pagination_tags %}

{% if object_list.exists %}
    <div class="foundry-container foundry-listing foundry-listing-widget" id="foundry-listing-{{ identifier|default:listing.id }}">

        {% if display_title %}{% if listing.title %}<div class="title">{{ listing.title }}</div>{% endif %}{% endif %}

        {% if pinned_list %}
        <div class="pinned-items">
        {% for object in pinned_list %}
            <div class="item {% if forloop.first %}first{% endif %} {% if forloop.last %}last{% endif %} item-{{ object.class_name|lower }}">
                {% render_object object.as_leaf_class "list_item_widget_pinned" %}
                <div class="clear"></div>
            </div>
        {% endfor %}
        </div>
        {% endif %}

        {% if view_modifier %}
            {% view_modifier view_modifier %}
        {% endif %}

        <div class="items">
        {% if items_per_page %}
            {% autopaginate object_list items_per_page %}
        {% endif %}
        {% for object in object_list %}
            <div class="item {% if forloop.first %}first{% endif %} {% if forloop.last %}last{% endif %} item-{{ object.class_name|lower }}">
                {% render_object object.as_leaf_class "list_item_widget" %}
                <div class="clear"></div>
            </div>
        {% endfor %}
        </div>
        {% if items_per_page %}
            {% paginate %}
        {% endif %}

    </div>
{% endif %}
