all repos — nirvash @ main

modular CMS using the quartzgun library

templates/file_list.html (raw)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
{{ $slug := ((.Context).Value "params").Slug }}
{{ $fileList := ((.Context).Value "file-manager").ListSubTree $slug }}

{{ template "header" .}}


{{ if ($fileList).Error }}

<h2>File Listing Error</h2>
<span class="adapter-error">{{($fileList).Error}}</span>

{{ else }}
<h2>Files: {{($fileList).Root}}</h2>

<div class="new-page-button-wrapper">
  <a class="new-page-button" href="/upload{{($fileList).Root}}">Upload File</a><br/>
  <a class="new-page-button" href="/mkdir{{($fileList).Root}}">New Directory</a>
</div>

<div class="page-list">
  <ul class="file-list">
  {{ if ($fileList).Up }}
    <li><a class="left-pad-uplink" href="/file-mgr{{$fileList.Up}}">..</a></li>
  {{ end }}
  {{ range $dir := ($fileList).SubDirs }}
    <li>
      <a class="file-actions-icon" href="/file-actions{{($fileList).Root}}{{$dir}}"><img src="/static/actions.png" width="16px" height="16px" alt="actions"/></a>
      <a href="/file-mgr{{($fileList).Root}}{{$dir}}">{{$dir}}/</a>
    </li>
  {{ end }}
  {{ range $file := ($fileList).Files }}
    <li>
      <a class="file-actions-icon" href="/file-actions{{($fileList).Root}}{{$file}}"><img src="/static/actions.png" width="16px" height="16px" alt="actions"/></a>
      <a href="/files{{($fileList).Root}}{{$file}}">{{$file}}</a>
    </li>
  {{ end }}
  </ul>
</div>

{{ end }}

{{ template "footer" .}}