{{template "layout.html" .}}

{{define "title"}}Loading{{end}}

{{define "content"}}
<h3>Load World</h3>
<p>Current Path: {{ .Current }}</p>
<table class="table table-hover object-table" style="white-space: nowrap;">
    <tr>
        <th width="100%">File</th>
        <th>Size</th>
        <th>Date</th>
    </tr>

    {{- range .Partitions }}
    <tr>
        <td><a href="/load?p={{ . }}"><i class="bi bi-hdd"></i> {{ . }}</a></td>
        <td></td>
        <td></td>
    </tr>
    {{- end }}

    <tr>
        <td><a href="/load?p={{ (printf `%s/..` $.Current) }}&x=1"><i class="bi bi-folder2"></i> ..</a></td>
        <td></td>
        <td></td>
    </tr>

    {{- range $f := .List }}{{- if $f.IsDir }}
    <tr>
        <td>
            <a href="/load?p={{ (printf `%s/%s` $.Current $f.Name) }}"><i class="bi bi-folder2"></i> {{$f.Name}}</a>
        </td>
        <td></td>
        <td></td>
    </tr>
    {{- end }}{{- end }}

    {{- range $f := .List }}{{- if isLegendsXml $f }}
    <tr>
        <td>
            <a class="loadable" href="/load?p={{ (printf `%s/%s` $.Current $f.Name) }}"><i class="bi bi-filetype-xml"></i> {{$f.Name}}</a>
        </td>
        <td>{{ bytes $f.Size }}</td>
        <td>{{ $f.ModTime.Format "02 Jan 06 15:04" }}</td>
    </tr>
    {{- end }}{{- end }}

</table>

<p>{{ json . }}</p>
{{- end }}