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