internal/web/templates/globalsearch.html
35 lines · 2012 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 {{if and .Query (not .QueryErr)}}<p class="meta">{{len .Results}} {{if eq (len .Results) 1}}result{{else}}results{{end}} for <q>{{.Query}}</q>{{if .Kind}} in {{.Kind}}{{end}}</p>{{end}}
12</div>
13<form method="get" action="/search" class="searchform">
14 <input type="search" name="q" aria-label="Search" value="{{.Query}}" placeholder="repository names and topics, issue and merge request text" autofocus>
15 {{if .Kind}}<input type="hidden" name="kind" value="{{.Kind}}">{{end}}
16 <button type="submit">search</button>
17</form>
18{{if .QueryErr}}<p class="error" role="alert">{{.QueryErr}}</p>
19{{else if .Query}}
20{{if .Results}}
21<ul class="issuelist">
22{{range .Results}}<li>
23 <div class="issuemain">
24 <p class="title"><a href="{{.Href}}">{{if .Number}}{{.Title}}{{else}}{{.Repo}}{{end}}</a></p>
25 <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>
26 </div>
27 {{if .State}}<span class="chip chip-{{.State}}">{{.State}}</span>{{end}}
28</li>
29{{end}}
30</ul>
31{{else}}<p class="empty-note">no matches for “{{.Query}}”</p>{{end}}
32{{else}}
33<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>
34{{end}}
35{{end}}