{% load urlreplace %}
{% load naturalduration %}

<table class="table table-striped table-sm">
    <thead>
        <tr>
            <th scope="col">Latest</th>
            <th scope="col">Title</th>
            {% if podcast_list or object_list.0.podcast %}
            <th scope="col">Podcast</th>
            {% endif %}
            {% if object_list.0.domain %}
            <th scope="col">Domain</th>
            {% endif %}
            {% if object_list.0.lat %}
            <th scope="col">Movement</th>
            {% endif %}
            <th scope="col">Scrobbles</th>
            <th scope="col">Start</th>
        </tr>
    </thead>
    <tbody>
        {% for obj in object_list %}
        <tr>
            <td><a href="{{obj.scrobble_set.last.get_absolute_url}}">{{obj.scrobble_set.last.local_timestamp}}
            <td><a href="{{obj.get_absolute_url}}">{{obj}}</a></td>
            {% if podcast_list or obj.podcast %}
            <td>{% if obj.podcast %}<a href="{{obj.podcast.get_absolute_url}}">{{obj.podcast}}</a>{% endif %}</td>
            {% endif %}
            {% if obj.domain %}
            <td><a href="{{obj.domain.get_absolute_url}}">{{obj.domain}}</a></td>
            {% endif %}
            {% if request.user.is_authenticated %}
            <td>{{obj.scrobble_count}}</td>
            {% if obj.start_url %}
            <td><a type="button" class="btn btn-sm btn-primary" href="{{obj.start_url}}">Scrobble</a></td>
            {% endif %}
            {% endif %}
        </tr>
        {% endfor %}
    </tbody>
</table>

<p class="pagination">
    <span class="page-links">
        {% if page_obj.has_previous %}
            <a href="?{% urlreplace page=page_obj.previous_page_number %}">prev</a>
        {% endif %}
            <span class="page-current">
                Page {{ page_obj.number }} of {{ page_obj.paginator.num_pages }}
            </span>
        {% if page_obj.has_next %}
            <a href="?{% urlreplace page=page_obj.next_page_number %}">next</a>
        {% endif %}
    </span>
</p>
