all repos — nirvash @ main

modular CMS using the quartzgun library

templates/file_actions.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
{{ $slug := ((.Context).Value "params").Slug }}
{{ $file := ((.Context).Value "file-manager").GetFileData $slug }}
{{ $csrfToken := (.Context).Value "csrfToken" }}

{{ template "header" . }}

{{ if ($file).Error }}
<h2>File Error</h2>

<span class="adapter-error">{{($file).Error}}</span>

{{ else }}
{{ if ($file).IsDir }}
<h2>Directory: {{($file).Name}}</h2>
{{ else }}
<h2>File: {{($file).Name}}</h2>
{{end}}

<div class="action-panel">
  <form class="file-move" method="GET" action="/file-move/{{($file).Path}}">
    <span>/{{($file).Path}}</span>
      <input hidden type="text" name="dest" value="{{($file).Parent}}"/>
      <input type="submit" value="Move/Rename"/>
  </form>
  <details class="danger-zone"><summary>Danger Zone</summary>
  <form class="file-delete" method="POST" action="/file-delete/{{($file).Path}}">
    <input hidden name="csrfToken" value="{{$csrfToken}}"/>
    <label>I want to delete this {{if ($file).IsDir }} diretory and everything under it {{ else }} file {{ end }}
      <input type="checkbox" required/><br/>
    </label>
    <label>Yes, I'm sure!
      <input type="checkbox" required/><br/>
    </label>
    <input type="submit" value="Delete"/>
  </form>
  </details>
</div>

{{ end }}

{{ template "footer" . }}