internal/web/templates/globalsearch.html
34 lines · 1824 bytes
1{{define "title"}}search · {{.Site}}{{end}}
2{{define "content"}}
3<div class="listhead">
4 <h1>Search</h1>
5 <nav class="filters">
6 <a {{if eq .Kind ""}}class="active" aria-current="page" {{end}}href="?q={{.Query}}">everything</a>
7 <a {{if eq .Kind "repo"}}class="active" aria-current="page" {{end}}href="?q={{.Query}}&kind=repo">repositories</a>
8 <a {{if eq .Kind "issue"}}class="active" aria-current="page" {{end}}href="?q={{.Query}}&kind=issue">issues</a>
9 <a {{if eq .Kind "mr"}}class="active" aria-current="page" {{end}}href="?q={{.Query}}&kind=mr">merge requests</a>
10 </nav>
11</div>
12<form method="get" action="/search" class="searchform">
13 <input type="search" name="q" aria-label="Search" value="{{.Query}}" placeholder="repository names and topics, issue and merge request text" autofocus>
14 {{if .Kind}}<input type="hidden" name="kind" value="{{.Kind}}">{{end}}
15 <button type="submit">search</button>
16</form>
17{{if .QueryErr}}<p class="error" role="alert">{{.QueryErr}}</p>
18{{else if .Query}}
19{{if .Results}}
20<ul class="issuelist">
21{{range .Results}}<li>
22 <div class="issuemain">
23 <p class="title"><a href="{{.Href}}">{{if .Number}}{{.Title}}{{else}}{{.Repo}}{{end}}</a></p>
24 <p class="meta">{{if .Number}}<a href="/{{.Repo}}">{{.Repo}}</a>{{.Marker}}{{.Number}} opened by <a href="/{{.Author}}">{{.Author}}</a>{{else if .Title}}{{.Title}}{{else}}repository{{end}}</p>
25 </div>
26 {{if .State}}<span class="chip chip-{{.State}}">{{.State}}</span>{{end}}
27</li>
28{{end}}
29</ul>
30{{else}}<p class="empty-note">no matches for “{{.Query}}”</p>{{end}}
31{{else}}
32<p class="empty-note">Repository names, descriptions and topics, and the title and body of every issue and merge request you can read. File contents are searched per repository, from a repository's Code tab.</p>
33{{end}}
34{{end}}