all repos — flounder @ 84556585e5f0af77f4a3c966fd9bb5bbd86937d3

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