all repos — flounder @ 137c6301b83699c6bdee329a8d85ca825317e4fe

A small site builder for the Gemini protocol

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      {{ .Name }}</a>
32  </td>
33  <td>
34  <a href="/edit/{{.Name}}">edit</a>
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    </form>
45  {{ end }}
46  </td>
47</div>
48</tr>
49{{ end }}
50<table>
51{{ range .Files }}
52{{ template "file" . }}
53{{ end }}
54</table>
55<h3>Create file by name:</h3>
56<noscript>Create a new page by going to /edit/[filename]</noscript>
57<input id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/newfile.gmi">
58<a href="#" id="create_new">Edit new file</a><br>
59<script>
60  var input = document.getElementById('edit_new')
61  var create = document.getElementById('create_new')
62  create.href = '/edit/' + input.value
63  input.onchange = input.onkeyup = function () {
64    create.href = '/edit/' + input.value
65  }
66</script>
67<br />
68<form action="/upload" enctype="multipart/form-data" method="POST">
69  <input type="file" id="myFile" name="file" multiple />
70  <input type="submit" value="Upload file" class="button" />
71</form>
72<br>
73{{template "footer" .}}