all repos — flounder @ 176ac4ccbf79af794a6869faee9994aa8913fbc4

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>
11For some help building your site, check out the <a href="https://admin.flounder.online/tips_and_tricks.gmi">Tips and Tricks</a> page.
12<br>
13<br>
14<h3>Your files:</h3>
15{{ define "file" }}
16<tr>
17<div>
18  {{ if gt (len .Children) 0 }}
19  <td colspan="3">
20  <details>
21    <summary>
22      <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">{{.Name}}/</a>
23    </summary>
24    <table>
25    {{ range .Children }}
26    {{ template "file" . }}
27    {{ end }}
28    </table>
29  </details>
30  </td>
31  {{ else }}
32  <td>
33    <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">
34      {{ if eq .Name  "index.gmi" }}
35      <b>{{ .Name }}</b>
36      {{ else }}
37      {{ .Name }}
38      {{ end }} </a>
39  </td>
40  <td>
41  <a href="/edit/{{.Name}}">edit</a>
42  </td>
43  <td>
44  <form action="/delete/{{.Name}}" method="POST" class="inline">
45    <input
46      class="button delete"
47      type="submit"
48      onclick="return confirm('Are you sure you want to delete this file?');"
49      value="delete"
50    />
51    </form>
52  {{ end }}
53  </td>
54</div>
55</tr>
56{{ end }}
57<table>
58{{ range .Files }}
59{{ template "file" . }}
60{{ end }}
61</table>
62<h3>Create file by name:</h3>
63<noscript>Create a new page by going to /edit/[filename]</noscript>
64<input type="text" id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/newfile.gmi">
65<a href="#" id="create_new">Edit new file</a><br>
66<script>
67  var input = document.getElementById('edit_new')
68  var create = document.getElementById('create_new')
69  create.href = '/edit/' + input.value
70  input.onchange = input.onkeyup = function () {
71    create.href = '/edit/' + input.value
72  }
73</script>
74<br />
75<a href="/edit/gemlog/{{.CurrentDate}}.gmi">New Gemlog Post</a>
76<br />
77<br />
78<form action="/upload" enctype="multipart/form-data" method="POST">
79  <input type="file" id="myFile" name="file" multiple />
80  <input type="submit" value="Upload file" class="button" />
81</form>
82<br>
83{{template "footer" .}}