{% extends "base.html" %}

{% block title %}{{ source_slug }}{% endblock %}

{% block content %}
<h1>{{ source_slug }}</h1>

{% if can_upload %}
<datasette-file-upload source="{{ source_slug }}"></datasette-file-upload>
<script type="module" src="{{ urls.static_plugins('datasette-files', 'datasette-file-upload.js') }}"></script>
{% endif %}

{% if files %}
<p>{{ total }} file{{ "s" if total != 1 else "" }}</p>
{% set show_source = False %}
{% include "_files_table.html" with context %}

{% if total_pages > 1 %}
<p style="margin-top: 1em;">
    {% if page > 1 %}
    <a href="{{ urls.path('/-/files/source/' ~ source_slug) }}?page={{ page - 1 }}">Previous</a>
    {% endif %}
    Page {{ page }} of {{ total_pages }}
    {% if page < total_pages %}
    <a href="{{ urls.path('/-/files/source/' ~ source_slug) }}?page={{ page + 1 }}">Next</a>
    {% endif %}
</p>
{% endif %}
{% else %}
<p>No files in this source.</p>
{% endif %}
{% endblock %}
