all repos — flounder @ 5c25dd5f433771a06e2d3f88173e23bfcdecaf48

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