nirvash/templates/file_actions.html

41 lines
1.2 KiB
HTML
Raw Normal View History

{{ $slug := ((.Context).Value "params").Slug }}
{{ $file := (.Context).Value "file-data" }}
{{ $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">
2022-06-13 06:32:14 +00:00
<form class="file-move" method="POST" action="/move-select/{{($file).Path}}">
<span>/{{($file).Path}}</span>
<input hidden name="csrfToken" value="{{$csrfToken}}"/>
<input type="submit" value="Move/Rename"/>
</form>
<details class="danger-zone"><summary>Danger Zone</summary>
2022-06-13 06:32:14 +00:00
<form class="file-delete" method="POST" action="/file-delete/{{($file).Path}}">
<input hidden name="csrfToken" value="{{$csrfToken}}"/>
2022-06-13 06:32:14 +00:00
<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" . }}