all repos — flounder @ f37b2e8dc4ee0c6517969b7d5df9b16cf318cbd6

A small site builder for the Gemini protocol

templates/my_site.html (view raw)

 1{{$authUser := .AuthUser.Username}}
 2{{template "header" .}}
 3<h1>Managing
 4  <a href="//{{.AuthUser.Username}}.{{.Config.Host}}">
 5    {{.AuthUser.Username}}.{{.Config.Host}}
 6  </a>
 7</h1>
 8{{template "nav.html" .}}
 9<br>
10For some help building your site, check out the <a href="https://admin.flounder.online/tips_and_tricks.gmi">Tips and Tricks</a> page.
11<br>
12<br>
13<h3>Your files:</h3>
14{{ define "file" }}
15<tr>{{ if gt (len .Children) 0 }}
16  <td colspan="3">
17  <details>
18    <summary>
19      <a href="//{{.Creator}}.{{.Host}}/{{.Name}}">{{.Name}}/</a>
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      {{ if hasSuffix .Name  "index.gmi" }}
32      <b>{{ .Name }}</b>
33      {{ else }}
34      {{ .Name }}
35      {{ end }} </a>
36  </td>
37  <td>
38  <a href="/edit/{{.Name}}">edit</a>
39  </td>
40  <td>
41  <form action="/delete/{{.Name}}" method="POST" class="inline">
42    <input
43      class="button delete"
44      type="submit"
45      onclick="return confirm('Are you sure you want to delete this file?');"
46      value="delete"
47    />
48    </form>
49  {{ end }}
50  </td></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 type="text" id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/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<a href="/edit/gemlog/{{.CurrentDate}}.gmi">New Gemlog Post</a>
71<br />
72<br />
73<form action="/upload" enctype="multipart/form-data" method="POST">
74  <input type="file" id="myFile" name="file" multiple />
75  <input type="submit" value="Upload file" class="button" />
76</form>
77<br>
78{{template "footer" .}}