oficina / memoria Public

Clone
git clone https://amadan.net/oficina/memoria

Plain git — no account needed to clone.

Download

Download this file

1{{define "content"}}
2
3{{/* rastrillo's [rst-search] IS the field box: its border, radius and
4 focus ring are on the form, and the input inside is transparent. The
5 button sits inside it, as rastrillo's list-bar-search does. memoria.css
6 used to draw a second bordered box on the input, which is the double
7 border the polish audit found. */}}
8<form method="get" action="/" rst-search>
9 <label for="q" class="rst-sr-only">Search the team's memory</label>
10 <input type="search" id="q" name="q" value="{{.Query}}" placeholder="Search the team's memory…" autofocus>
11 <button rst-btn="primary">Search</button>
12</form>
13
14{{/* The results region. search.js writes live results into it, and it
15 is here rather than around the {{if}} because an absent region has
16 nothing to write into: on a page with no search this empty div is
17 where the first results go. Nothing the person is typing into is
18 inside it.
19
20 rst-search-results-for is the query these results were rendered
21 from, written by the server. search.js reads it instead of assuming
22 the box and the screen agree: after a Back, a browser restores the
23 input's value on its own schedule, and a script that trusted the
24 box would think a stale screen was current. */}}
25<p class="rst-sr-only" role="status" rst-search-status></p>
26<div rst-refresh="results"
27 rst-search-results-for="{{.Query}}"
28 rst-search-stale-note="{{template "searchFailed"}}">{{template "results" .}}</div>
29
30{{/* Adding content lives at /add now. The one message that still lands
31 on this page is a failed delete, which redirects here. */}}
32{{if .Flash}}<div rst-callout rst-tone="{{.FlashKind | tone}}"{{if eq .FlashKind "danger"}} role="alert"{{end}}><div rst-callout-body><p>{{.Flash}}</p></div></div>{{end}}
33
34<section rst-section>
35 <h2>{{len .Documents}} document{{if ne (len .Documents) 1}}s{{end}}</h2>
36 <p><a rst-btn="primary" href="/add">Add content</a></p>
37 {{if not .Documents}}
38 <p rst-muted>Nothing stored yet.</p>
39 {{else}}
40 <table rst-table>
41 <thead><tr><th>Title</th><th>Source</th><th>Passages</th><th>Updated</th><th></th></tr></thead>
42 <tbody>
43 {{range .Documents}}
44 <tr>
45 <td><a href="/documents/{{.ID}}">{{.Title}}</a></td>
46 <td rst-muted>{{.Source}}</td>
47 <td rst-muted>{{.Chunks}}</td>
48 <td rst-muted>{{.Updated}}</td>
49 {{/* Delete asks first (delete.html): a link to the question, not
50 a one-click POST. */}}
51 <td><a rst-btn="quiet compact" href="/documents/{{.ID}}/delete">Delete</a></td>
52 </tr>
53 {{end}}
54 </tbody>
55 </table>
56 {{end}}
57</section>
58{{end}}
59