oficina / mapa Public

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

Plain git — no account needed to clone.

Download

Download this file

1{{define "content"}}{{$r := .Data}}
2{{template "page-header" dict "Title" "Search" "Sub" "Team pages, and your own notes."}}
3<form method="get" action="/search" role="search" mapa-search rst-stack>
4<div rst-field>
5<label rst-field-label for="q">Search for</label>
6<div mapa-search-row>
7<input rst-input type="search" id="q" name="q" value="{{$r.Query}}" autocomplete="off" autofocus mapa-search-box>
8<button rst-btn="primary" type="submit">{{icon "search"}} Search</button>
9</div>
10</div>
11<p mapa-meta mapa-search-hint>Type a date, like “friday”, to open that day.</p>
12</form>
13{{if $r.Query}}
14{{with $r.Date}}<section mapa-search-group aria-label="A date">
15<ul mapa-list mapa-results>
16<li mapa-result mapa-date-row><span mapa-result-ic>{{icon "calendar"}}</span><div><a href="{{.Href}}">{{.Label}}</a> <span mapa-meta>Your note</span></div></li>
17</ul>
18</section>{{end}}
19{{with $r.Pages}}<section mapa-search-group aria-labelledby="group-pages">
20<h2 mapa-search-head id="group-pages">Pages</h2>
21<ul mapa-list mapa-results>
22{{range .}}<li mapa-result><span mapa-result-ic>{{pageIcon .Look "file-text"}}</span><div>{{if .Via}}<a href="{{.Href}}">{{.Via}}</a> <span mapa-meta>Old title of {{.Label}}</span>{{else}}<a href="{{.Href}}">{{.Label}}</a> <span mapa-meta>Team page</span>{{end}}</div></li>
23{{end}}</ul>
24</section>{{end}}
25{{with $r.Text}}<section mapa-search-group aria-labelledby="group-text">
26<h2 mapa-search-head id="group-text">In the text</h2>
27<ul mapa-list mapa-results>
28{{range .}}<li mapa-result><span mapa-result-ic>{{pageIcon .Look "file-text"}}</span><div><a href="{{.Href}}">{{.Label}}</a>{{template "search-snippet" .Snippet}}</div></li>
29{{end}}</ul>
30</section>{{end}}
31{{with $r.Notes}}<section mapa-search-group aria-labelledby="group-notes">
32<h2 mapa-search-head id="group-notes">Your notes <span mapa-meta>Only you see these</span></h2>
33<ul mapa-list mapa-results>
34{{range .}}<li mapa-result><span mapa-result-ic>{{if eq .Kind "daily"}}{{icon "calendar"}}{{else}}{{icon "sticky-note"}}{{end}}</span><div><a href="{{.Href}}">{{.Label}}</a>{{if .Snippet}}{{template "search-snippet" .Snippet}}{{else}} <span mapa-meta>{{if eq .Kind "daily"}}Your daily note{{else}}Your scratch page{{end}}</span>{{end}}</div></li>
35{{end}}</ul>
36</section>{{end}}
37{{if not $r.Count}}<p mapa-meta>Nothing matches “{{$r.Query}}”.</p>{{end}}
38{{with $r.Create}}<p mapa-create><a rst-btn href="/new?title={{.}}">{{icon "file-plus"}} Create “{{.}}”</a> <span mapa-meta>A new team page with this title</span></p>{{end}}
39{{end}}
40{{end}}
41
42{{define "search-snippet"}}{{with .}}<p mapa-meta mapa-snippet>{{range .Parts}}{{if .Marked}}<mark>{{.Text}}</mark>{{else}}{{.Text}}{{end}}{{end}}</p>{{end}}{{end}}
43