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 <td>
16 <a href="//{{$authUser}}.{{$domain}}/{{.Name}}">
17 {{ .Name }}</a>
18 </td>
19 <td>
20 {{ if .IsText }}
21 <a href="/edit/{{.Name}}">edit</a>
22 {{ end }}
23 </td>
24 <td>
25 <form action="/delete/{{.Name}}" method="POST" class="inline">
26 <input
27 class="button delete"
28 type="submit"
29 onclick="return confirm('Are you sure you want to delete this file?');"
30 value="delete"
31 />
32 </td>
33 </form>
34</div>
35</tr>
36{{ end }}
37</table>
38<h3>Create file by name:</h3>
39<noscript>Create a new page by going to /edit/[filename]</noscript>
40<input id="edit_new" size=32 placeholder="New filename, e.g. newfile.gmi" />
41<a href="#" id="create_new">Edit new file</a><br>
42<script>
43 var input = document.getElementById('edit_new')
44 var create = document.getElementById('create_new')
45 create.href = '/edit/' + input.value
46 input.onchange = input.onkeyup = function () {
47 create.href = '/edit/' + input.value
48 }
49</script>
50<br />
51<form action="/upload" enctype="multipart/form-data" method="POST">
52 <input type="file" id="myFile" name="file" multiple />
53 <input type="submit" value="Upload file" class="button" />
54</form>
55{{template "footer" .}}