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" .}}
10For some help building your site, check out the <a href="https://admin.flounder.online/tips_and_tricks.gmi">Tips and Tricks</a> page.
11<br>
12<h3>Your files:</h3>
13{{ define "file" }}
14<tr>
15<div>
16 {{ if gt (len .Children) 0 }}
17 <td colspan="3">
18 <details>
19 <summary>
20 <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">{{.Name}}/</a>
21 </summary>
22 <table>
23 {{ range .Children }}
24 {{ template "file" . }}
25 {{ end }}
26 </table>
27 </details>
28 </td>
29 {{ else }}
30 <td>
31 <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">
32 {{ if eq .Name "index.gmi" }}
33 <b>{{ .Name }}</b>
34 {{ else }}
35 {{ .Name }}
36 {{ end }} </a>
37 </td>
38 <td>
39 <a href="/edit/{{.Name}}">edit</a>
40 </td>
41 <td>
42 <form action="/delete/{{.Name}}" method="POST" class="inline">
43 <input
44 class="button delete"
45 type="submit"
46 onclick="return confirm('Are you sure you want to delete this file?');"
47 value="delete"
48 />
49 </form>
50 {{ end }}
51 </td>
52</div>
53</tr>
54{{ end }}
55<table>
56{{ range .Files }}
57{{ template "file" . }}
58{{ end }}
59</table>
60<h3>Create file by name:</h3>
61<noscript>Create a new page by going to /edit/[filename]</noscript>
62<input type="text" id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/newfile.gmi">
63<a href="#" id="create_new">Edit new file</a><br>
64<script>
65 var input = document.getElementById('edit_new')
66 var create = document.getElementById('create_new')
67 create.href = '/edit/' + input.value
68 input.onchange = input.onkeyup = function () {
69 create.href = '/edit/' + input.value
70 }
71</script>
72<br />
73<a href="/edit/gemlog/{{.CurrentDate}}.gmi">New Gemlog Post</a>
74<br />
75<br />
76<form action="/upload" enctype="multipart/form-data" method="POST">
77 <input type="file" id="myFile" name="file" multiple />
78 <input type="submit" value="Upload file" class="button" />
79</form>
80<br>
81{{template "footer" .}}