nirvash/templates/file_actions.html

40 lines
No EOL
1.2 KiB
HTML

{{ $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 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" . }}