{% extends 'base.html.twig' %}

{% block body %}
    <h3>Index for <em>{{ url }}</em></h3>
    <div class="toolbar">
        {% if write %}
            <span class="toolbar-item">
                <a class="toolbar-button" href="{#{ 'create_dir' }#}">
                    <img src="{{ asset('icons/mkdir.svg') }}" alt="create-icon"/>
                </a>
            </span>
            <span class="toolbar-item">
                <a class="toolbar-button" href="{#{ 'upload_file' }#}">
                    <img alt="upload-icon" src="{{ asset('icons/upload.svg') }}"/>
                </a>
            </span>
        {% endif %}
    </div>
    <table class="full-width"><!-- Directory Index -->
        <tr>
            <th class="td-color shrink-to-fit"><a href="{#{ 'sort_standard_href' }#}"><img class="list-icon icon-empty" alt="[icon]" /></a></th>
            <th class="td-color fullwidth left"><a href="{#{ 'sort_name_href' }#}">Name</a></th>
            <th class="td-color shrink-to-fit left"><a href="{#{ 'sort_name_href' }#}">Size</a></th>
            <th class="td-color shrink-to-fit left"><a href="{#{ 'sort_time_href' }#}">Last changed</a></th>
            <th class="td-color shrink-to-fit left"></th>
        </tr>
        <tr><td colspan="5"><strong><hr></strong></td></tr>
        {% if parent_url %}
            <tr>
                <td><img class="list-icon icon-back" alt="[icon]"/></td>
                <td><a href="{{ parent_url }}">Zurück</a></td>
                <td>-</td>
                <td>-</td>
                <td>-</td>
                <td><img class="list-icon icon-empty" alt="[icon]"/></td>
            </tr>
        {% endif %}
        {% for entry in dir_entries %}
            <tr>
                <td><img class="list-icon {{ entry.icon }}" alt="[icon]"/></td>
                <td><a href="{{ entry.href }}">{{ entry.name }}</a></td>
                <td>{{ entry.size }}</td>
                <td>{{ entry.mtime }}</td>
                <td>
                    {% if entry.delete %}
                        <a href="{{ entry.delete }}"<img class="list-icon icon-delete" alt="[icon]" /></a>
                    {% else %}
                        <img class="list-icon icon-empty" alt="[icon]" />
                    {% endif %}
                </td>
            </tr>
        {% endfor %}
        <tr><td colspan="5"><strong><hr></strong></td></tr>
    </table>
{% endblock %}

