{% extends "base.html" %}
{% block title %}Index of {{ path }}{% endblock %}
{% block links %}
<link rel="stylesheet" type="text/css" href="{{ static_url('index.css') }}">
{%- endblock %}
{% block scripts %}
<script src="{{ static_url('common.js') }}"></script>
<script src="{{ static_url('index.js') }}"></script>
{%- endblock %}
{% block content %}
<header>
<h1 id="header" class="breadcrumbs">
{%- for label, subpath, sep, is_last in get_breadcrumbs(pathparts, base, sitename) -%}
  {%- if not loop.last -%}
    <a href="{{ quote_path(subpath) }}">{{ label }}</a>{{ sep }}
  {%- else -%}
    <a>{{ label }}</a>{{ sep }}
  {%- endif -%}
{%- endfor -%}
</h1>
</header>
<main>
<table id="data-table" data-sitename="{{ sitename }}" data-base="{{ base }}" data-path="{{ path }}">
<thead>
  <tr><th><a hidden>Directory</a></th><th><a>Name</a></th><th class="detail"><a>Last modified</a></th><th class="detail"><a>Size</a></th></tr>
</thead>
<tbody>
{%- for info in subentries %}
  {%- set filename = info.name %}
  {%- set url = quote_path(info.name) + ('/' if info.type == 'dir' else '') %}
  {%- set filetype = info.type %}
  {%- set size = info.size %}
  {%- set size_text = format_filesize(size) if size else '' %}
  {%- set lm = info.last_modified %}
  {%- set lm_text = time.strftime("%Y/%m/%d %H:%M:%S", time.localtime(lm)) %}
  <tr class="{{ filetype }}"><td data-sort="{{ filename }}"><a class="icon {{ filetype }}" title="{{ filename }}"></a><td data-sort="{{ filename }}"><a href="{{ url }}">{{ filename }}</a></td><td class="detail" data-sort="{{ lm or '' }}">{{ lm_text }}</td><td class="detail" data-sort="{{ size or '' }}">{{ size_text }}</td></tr>
{%- endfor %}
</tbody>
</table>
</main>
<footer>
<form id="panel" autocomplete="off" hidden>
  <select id="viewer">
    <option value="" selected>Normal View</option>
    <option value="gallery">Gallery View</option>
    <option value="list">List View</option>
    <option value="deep">Deep List</option>
  </select>
  <select id="command">
    <option value="" selected>...</option>
    <option value="source" hidden>View source</option>
    <option value="download" hidden>Download</option>
    <option value="exec" hidden{{ '' if is_local else ' disabled' }}>Run natively</option>
    <option value="browse" hidden{{ '' if is_local else ' disabled' }}>Browse natively</option>
    <option value="mkdir" hidden>New folder</option>
    <option value="mkzip" hidden>New zip</option>
    <option value="edit" hidden>New file</option>
    <option value="editx" hidden>Edit page</option>
    <option value="upload" hidden>Upload</option>
    <option value="move" hidden>Move</option>
    <option value="copy" hidden>Copy</option>
    <option value="link" hidden>Create link</option>
    <option value="delete" hidden>Delete</option>
  </select>
  <input type="file" id="upload-file-selector" multiple hidden>
</form>
</footer>
{% endblock %}