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