all repos — flounder @ 5a1f407a0b10e1b634855573fff2df16d88fb952

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