all repos — flounder @ v0.1.1

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{{ if ne .Name "following.gmi" }}
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 hasSuffix .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{{ end }}
58<table>
59{{ range .Files }}
60{{ template "file" . }}
61{{ end }}
62</table>
63<h3>Create file by name:</h3>
64<noscript>Create a new page by going to /edit/[filename]</noscript>
65<input type="text" id="edit_new" size=32 placeholder="e.g. newfile.gmi or folder/newfile.gmi">
66<a href="#" id="create_new">Edit new file</a><br>
67<script>
68  var input = document.getElementById('edit_new')
69  var create = document.getElementById('create_new')
70  create.href = '/edit/' + input.value
71  input.onchange = input.onkeyup = function () {
72    create.href = '/edit/' + input.value
73  }
74</script>
75<br />
76<a href="/edit/gemlog/{{.CurrentDate}}.gmi">New Gemlog Post</a>
77<br />
78<br />
79<form action="/upload" enctype="multipart/form-data" method="POST">
80  <input type="file" id="myFile" name="file" multiple />
81  <input type="submit" value="Upload file" class="button" />
82</form>
83<br>
84{{template "footer" .}}