{% extends "base.html" %}
{% block content %}
{% include 'breadcrumbs.html' %}

    <h1 class="title is-large butter-title">{{ _('File Viewer') }}</h1>
<div>
<table class="table" style="margin: 0 auto">
  <thead>
    <tr>
       <th></th>
      <th>{{ _("File Name")}}</th>
      <th class="file-viewer-date-modified">{{ _("Date modified")}}</th>
        <th>{{ _("Download") }}</th>
    </tr>
  </thead>
      <tbody>
    {% for f in render_files %}
    <tr>
        <td><img src="{{ f.icon_url}}"></td>
        {% if f.is_dir %}
        <td><a href="/{{ request.endpoint}}/{{ f.relative_path}}">{{ f.name}}</a></td>
        {% endif %}

        {% if f.is_file %}
        <td>{{ f.name}}</td>
        {% endif %}

        <td class="file-viewer-date-modified">{{ f.last_modified}}</td>
          {% if f.is_file %}
           <td><a href="{{ url_for('serve_file', filepath=f.path) }}">{{ _("Download") }}</a></td>
          {% endif %}
          {% if f.is_dir %}
            <td></td>
          {% endif %}
      </tr>
    {% endfor %}
      {% if not render_files %}
    <tr>
        <td colspan="4"> <p class="butter-centered has-text-grey">{{ _("Directory is empty") }}</p></td>
    </tr>
      {% endif %}
</tbody>
</table>
</div>
 {% endblock %}