{% extends "base.html" %}

{% block title %}Search files{% endblock %}

{% block content %}
<h1>Search files</h1>

<form action="{{ urls.path('/-/files/search') }}" method="get" style="margin-bottom: 1.5em;">
    <p>
        <input type="search" name="q" value="{{ q }}" placeholder="Search filenames..." style="width: 300px; padding: 6px;">
        {% if sources|length > 1 %}
        <select name="source">
            <option value="">All sources</option>
            {% for source in sources %}
            <option value="{{ source }}"{% if source == source_filter %} selected{% endif %}>{{ source }}</option>
            {% endfor %}
        </select>
        {% endif %}
        <button type="submit">Search</button>
    </p>
</form>

{% if q and not files %}
<p>No files found for "{{ q }}".</p>
{% elif not q and not files %}
<p>No files available.</p>
{% else %}
{% include "_files_table.html" with context %}
{% endif %}
{% endblock %}
