<div class="cs-module-spinner" style="display: none;"></div>

<h4 class="semibold">{{ 'related_content.results.title'|trans }}</h4>

<!-- Search results content types -->
{% if tabs.results|length and pagination|length %}
    <ul class="nav nav-pills filter-pills" data-action="filter-type">
        <li {% if type == 0 %}class="active"{% endif %}><a href="#" data-toggle="tab" data-type="0">{{ 'related_content.results.filters.all'|trans }} <span class="badge badge-info">{{ tabs.totals }}</span></a></li>
        {% for tab in tabs.results if tabs.results|length > 1 %}
            <li {% if tab.selected %}class="active"{% endif %}><a href="#" data-toggle="tab" data-type="{{ tab.type }}">{{ ("cs_content_type.types." ~ tab.type)|trans }} <span class="badge badge-info">{{ tab.count }}</span></a></li>
        {% endfor %}
    </ul>
{% endif %}
<!-- /Search results content types -->

<table class="table table-bordered">
    {% if pagination|length %}
    <thead>
    <tr>
        <th class="hidden-md hidden-xs hidden-sm">{{ 'related_content.results.header.id'|trans }}</th>
        <th class="col-md-6">{{ 'related_content.results.header.title'|trans }}</th>
        <th class="col-md-2 text-center">{{ 'related_content.results.header.state'|trans }}</th>
        <th class="col-md-2 text-center hidden-md hidden-xs hidden-sm">{{ 'related_content.results.header.published'|trans }}</th>
        <th class="col-md-2 text-center">{{ 'related_content.results.header.actions'|trans }}</th>
    </tr>
    {% endif %}
    </thead>
    <tbody>
    {% for item in pagination %}
        <tr data-object="{{ item.serialized }}">
            <td class="hidden-md hidden-xs hidden-sm">{{ item.entityId }}</td>
            <td>
                {% if item.icon_text %}
                    <span class="text-over">{{ item.icon_text|raw }}</span><br />
                {% endif %}
                <span class="info-icon"><i class="{{ item.icon }}"></i></span> {{ item.title }}

                {% if item.subSite|first.acronym != get_subsite_acronym() %}
                    <span class="subsite">{{ item.subSite|first.name }}</span>
                {% endif %}
            </td>
            <td>
                <span class="status {{ item.state.name|default('') }} text-center">
                    {{ item.state is defined ? item.state.title : "-" }}
                </span>
            </td>
            <td class="hidden-md hidden-xs hidden-sm text-center">{% if item.publishedDate %}  {{ time_diff(item.publishedDate) }}{% else %}-{% endif %}</td>
            <td class="text-center">
                <span class="opts">
                    <a href="#" title="{{ 'related_content.results.actions.add'|trans }}" class="btn btn-icon-only btn-circle blue" {% block dataAction %}{% endblock %}><i class="fa fa-plus"></i></a>
                </span>
            </td>
        </tr>
    {% else %}
        <tr>
            <td class="alert-info text-center" colspan="5">{{ 'related_content.suggest.no_results'|trans }}</td>
        </tr>
    {% endfor %}
    </tbody>
</table>

{{ knp_pagination_render(pagination, 'Comitium5DesignerBundle:Common:pagination.html.twig') }}
