templates/my_site.html (view raw)
1{{$domain := .Host}}
2{{$authUser := .AuthUser.Username}}
3{{template "header" .}}
4<h1>Managing
5 <a href="//{{$authUser}}.{{$domain}}">
6 {{$authUser}}.{{$domain}}
7 </a>
8</h1>
9{{template "nav.html" .}}
10<br>
11<h3>Your files:</h3>
12{{ define "file" }}
13<tr>
14<div>
15 {{ if gt (len .Children) 0 }}
16 <td colspan="3">
17 <details>
18 <summary>
19 {{.Name}}/
20 </summary>
21 <table>
22 {{ range .Children }}
23 {{ template "file" . }}
24 {{ end }}
25 </table>
26 </details>
27 </td>
28 {{ else }}
29 <td>
30 <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">
31 {{ if eq .Name "index.gmi" }}
32 <b>{{ .Name }}</b>
33 {{ else }}
34 {{ .Name }}
35 {{ end }} </a>
36 </td>
37 <td>
38 <a href="/edit/{{.Name}}">edit</a>
39 </td>
40 <td>
41 <form action="/delete/{{.Name}}" method="POST" class="inline">
42 <input
43 class="button delete"
44 type="submit"
45 onclick="return confirm('Are you sure you want to delete this file?');"
46 value="delete"
47 />
48 </form>
49 {{ end }}
50 </td>
51</div>
52</tr>
53{{ end }}
54<table>
55{{ range .Files }}
56{{ template "file" . }}
57{{ end }}
58</table>
59<h3>Create file by name:</h3>
60<noscript>Create a new page by going to /edit/[filename]</noscript>
61<input id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/newfile.gmi">
62<a href="#" id="create_new">Edit new file</a><br>
63<script>
64 var input = document.getElementById('edit_new')
65 var create = document.getElementById('create_new')
66 create.href = '/edit/' + input.value
67 input.onchange = input.onkeyup = function () {
68 create.href = '/edit/' + input.value
69 }
70</script>
71<br />
72<form action="/upload" enctype="multipart/form-data" method="POST">
73 <input type="file" id="myFile" name="file" multiple />
74 <input type="submit" value="Upload file" class="button" />
75</form>
76<br>
77{{template "footer" .}}