all repos — flounder @ f538215f8cceaf1c7337329ad4aa3b79977042c2

A small site builder for the Gemini protocol

templates/my_site.html (view raw)

 1{{$domain := .Host}}
 2{{$authUser := .AuthUser}}
 3{{template "header" .}}
 4<h1>Managing
 5  <a href="https://{{$authUser}}.{{$domain}}">
 6    {{.AuthUser}}.{{$domain}}
 7  </a>
 8</h1>
 9{{template "nav.html" .}}
10<h3>Your files:</h3>
11{{ range .Files }}
12<div>
13  <a href="https://{{$authUser}}.{{$domain}}/{{.Name}}">
14      {{ .Name }}</a>
15  <a href="/edit/{{.Name}}">edit</a>
16  <form action="/delete/{{.Name}}" method="POST" class="inline">
17    <input
18      class="button"
19      type="submit"
20      onclick="return confirm('Are you sure you want to delete this file?');"
21      value="delete"
22    />
23  </form>
24</div>
25{{ end }}
26<h3>Create file by name:</h3>
27<noscript>Create a new page by going to /edit/[filename]</noscript>
28<input id="edit_new" size=32 placeholder="New filename, e.g. newfile.gmi" />
29<a href="#" id="create_new">Edit new page</a><br>
30<script>
31  var input = document.getElementById('edit_new')
32  var create = document.getElementById('create_new')
33  create.href = '/edit/' + input.value
34  input.onchange = input.onkeyup = function () {
35    create.href = '/edit/' + input.value
36  }
37</script>
38<br />
39<form action="/upload" enctype="multipart/form-data" method="POST">
40  <input type="file" id="myFile" name="file" multiple />
41  <input type="submit" value="Upload file" class="button" />
42</form>
43{{template "footer" .}}