| 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 | {{/* The front page is a search box and nothing else (Paul, 2026-10-29: |
| 9 | "a bit more like Google with a simple search box in the middle"). |
| 10 | With no query the box sits in the middle of the screen (Paul, |
| 11 | 2026-10-30: no logo, no "cruft", "vertically centered"), with the |
| 12 | last few searches and recently updated documents under it. A page |
| 13 | loaded WITH a query — a link, a reload, a scriptless submit — is a |
| 14 | results page and starts at the top. The documents list is /documents. */}} |
| 15 | <div{{if not .Searched}} rst-home{{end}} rst-stack> |
| 16 | {{/* rst-suggest positions the typeahead under the box; search.js fills |
| 17 | rst-suggest-box from /suggest. Without the script it stays empty and |
| 18 | hidden, and Enter is the form's submit. */}} |
| 19 | <div rst-suggest> |
| 20 | <form method="get" action="/" rst-search> |
| 21 | <label for="q" class="rst-sr-only">Search the team's memory</label> |
| 22 | <input type="search" id="q" name="q" value="{{.Query}}" placeholder="Search the team's memory…"{{if not .Searched}} autofocus{{end}}> |
| 23 | {{/* Clear (Paul, 2026-10-31): rastrillo's real link in place of the |
| 24 | browser's own ✕, which empties the box but leaves the results and |
| 25 | the ?q= standing. Without a script it goes to the front page; with |
| 26 | one, search.js empties the box and keeps the caret in it, and |
| 27 | shows the link only while there is something to clear. */}} |
| 28 | <a href="/" rst-search-clear aria-label="Clear search"{{if not .Query}} hidden{{end}}>{{icon "x"}}</a> |
| 29 | <button rst-btn="primary">Search</button> |
| 30 | </form> |
| 31 | <div rst-suggest-box hidden></div> |
| 32 | </div> |
| 33 | {{if not .Searched}} |
| 34 | {{/* Team mode, standing Unknown: nothing under the box, and the notice |
| 35 | says why (team_access.go). */}} |
| 36 | {{if .Partial}}{{template "partial" .}}{{end}} |
| 37 | {{/* Under the box (Paul, 2026-10-30): the last few searches and what |
| 38 | changed lately. Recent searches live in this browser only |
| 39 | (localStorage, search.js): a query is content, and memoria keeps no |
| 40 | query on the server. Without a script that list stays hidden. */}} |
| 41 | {{with .Try}} |
| 42 | {{/* Searches built from what the documents hold: their labels for |
| 43 | checked values, and people other documents mention (trysuggest.go). */}} |
| 44 | <p rst-home-try><span rst-muted>Try</span>{{range .}} <a href="/?q={{.}}" rst-home-chip>{{.}}</a>{{end}}</p> |
| 45 | {{end}} |
| 46 | <div rst-home-lists rst-section> |
| 47 | <section rst-home-history rst-stack hidden> |
| 48 | <h2 rst-home-label>Recent searches <button type="button" rst-home-clear>Clear</button></h2> |
| 49 | <ul rst-home-list></ul> |
| 50 | </section> |
| 51 | {{if or .Recent .RecentNotices}} |
| 52 | {{/* The notices stand without the list: when every recent document is |
| 53 | withheld, an empty section with "Docs did not answer" is the loud |
| 54 | withholding §4.1 asks for, and no section at all would be silent |
| 55 | (Fable's review of e1f6829). */}} |
| 56 | <section rst-stack> |
| 57 | <h2 rst-home-label>Recently updated</h2> |
| 58 | {{range .RecentNotices}}<p rst-muted rst-home-notice>{{.}}</p>{{end}} |
| 59 | {{with .Recent}}<ul rst-home-list> |
| 60 | {{/* The whole row opens it (Paul, 2026-10-31): rastrillo's list row, |
| 61 | whose one primary link covers the row. */}} |
| 62 | {{range .}}<li rst-row><span rst-row-main><a href="/documents/{{.ID}}">{{.Title}}</a><span rst-row-sub>{{if .Path}}{{.Path}} · {{end}}<time datetime="{{.UpdatedISO}}">{{.UpdatedDay}}</time></span></span></li>{{end}} |
| 63 | </ul>{{end}} |
| 64 | </section> |
| 65 | {{end}} |
| 66 | </div> |
| 67 | {{end}} |
| 68 | |
| 69 | {{/* The results region. On a results page it holds the results and the |
| 70 | AI answer's slot; on the front page it is empty. |
| 71 | |
| 72 | rst-search-results-for is the query these results were rendered |
| 73 | from, written by the server. search.js reads it, not the box, to ask |
| 74 | for the AI answer: after a Back a browser restores the input's value |
| 75 | on its own schedule, and the box can disagree with the screen. */}} |
| 76 | <div rst-refresh="results" rst-stack rst-section |
| 77 | rst-search-results-for="{{.Query}}">{{template "results" .}}</div> |
| 78 | </div> |
| 79 | |
| 80 | {{/* The one message still set for this page: "Thanks — saved" after a |
| 81 | correction or a rating, which return to the search. */}} |
| 82 | {{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}} |
| 83 | {{end}} |
| 84 | |
| 85 | |