all repos — flounder @ 3fb8fb8a30e4be06a5582316ce84fe6a12b75ee3

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{{ define "file" }}
12<tr>
13<div>
14  {{ if gt (len .Children) 0 }}
15  <td colspan="3">
16  <details>
17    <summary>
18      {{.Name}}/
19    </summary>
20    <table>
21    {{ range .Children }}
22    {{ template "file" . }}
23    {{ end }}
24    </table>
25  </details>
26  </td>
27  {{ else }}
28  <td>
29    <a href="//authUser.domain/{{.Name}}">
30      {{ .Name }}</a>
31  </td>
32  <td>
33  {{ if .IsText }}
34  <a href="/edit/{{.Name}}">edit</a>
35  {{ end }}
36  </td>
37  <td>
38  <form action="/delete/{{.Name}}" method="POST" class="inline">
39    <input
40      class="button delete"
41      type="submit"
42      onclick="return confirm('Are you sure you want to delete this file?');"
43      value="delete"
44    />
45    </form>
46  {{ end }}
47  </td>
48</div>
49</tr>
50{{ end }}
51<table>
52{{ range .Files }}
53{{ template "file" . }}
54{{ end }}
55</table>
56<h3>Create file by name:</h3>
57<noscript>Create a new page by going to /edit/[filename]</noscript>
58<input id="edit_new" size=32 placeholder="New filename, e.g. newfile.gmi" />
59<a href="#" id="create_new">Edit new file</a><br>
60<script>
61  var input = document.getElementById('edit_new')
62  var create = document.getElementById('create_new')
63  create.href = '/edit/' + input.value
64  input.onchange = input.onkeyup = function () {
65    create.href = '/edit/' + input.value
66  }
67</script>
68<br />
69<form action="/upload" enctype="multipart/form-data" method="POST">
70  <input type="file" id="myFile" name="file" multiple />
71  <input type="submit" value="Upload file" class="button" />
72</form>
73<br>
74<p><a href="/my_site/flounder-archive.zip">🗄️ Download site archive (.zip)</a></p>
75{{template "footer" .}}