internal/web/templates/globalsearch.html

v1.40.1
gitbay/internal/web/templates/globalsearch.html history · blame · raw

50 lines · 2709 bytes

 1{{define "width"}}wide{{end}}
 2{{define "title"}}search · {{.Site}}{{end}}
 3{{define "content"}}
 4<div class="withcol">
 5<nav class="sidecol" aria-label="Filters">
 6<details class="sidedrop">
 7<summary><span class="sideword">Filters</span>{{if .Kind}} <span class="sideon">{{.Kind}}</span>{{end}}</summary>
 8  <div class="grp"><h2 class="colhead">Kind</h2>
 9  <ul>
10    <li><a{{if eq .Kind ""}} aria-current="page"{{end}} href="?q={{.Query}}">everything</a></li>
11    <li><a{{if eq .Kind "repo"}} aria-current="page"{{end}} href="?q={{.Query}}&amp;kind=repo">repositories</a></li>
12    <li><a{{if eq .Kind "issue"}} aria-current="page"{{end}} href="?q={{.Query}}&amp;kind=issue">issues</a></li>
13    <li><a{{if eq .Kind "mr"}} aria-current="page"{{end}} href="?q={{.Query}}&amp;kind=mr">merge requests</a></li>
14  </ul></div>
15</details>
16</nav>
17<div class="colmain">
18<div class="listhead">
19  <h1>Search</h1>
20  {{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}}
21</div>
22<form method="get" action="/search" class="searchform">
23  <input type="search" name="q" aria-label="Search" value="{{.Query}}" placeholder="repository names and topics, issue and merge request text">
24  {{if .Kind}}<input type="hidden" name="kind" value="{{.Kind}}">{{end}}
25  <button type="submit" class="btn">Search</button>
26</form>
27{{if .QueryErr}}<p class="error" role="alert">{{.QueryErr}}</p>
28{{else if .Query}}
29{{if .Results}}
30<ul class="issuelist rows">
31{{range .Results}}<li>
32  <div class="issuemain">
33    <p class="title"><a href="{{.Href}}">{{if .Number}}{{.Title}}{{else}}{{.Repo}}{{end}}</a></p>
34    <p class="meta">{{if .Number}}<a href="/{{.Repo}}">{{.Repo}}</a>{{.Marker}}{{.Number}} opened by <a href="/{{.Author}}">{{.Author}}</a>{{else if .Title}}{{.Title}}{{end}}</p>
35  </div>
36  {{/* the kind in the words the CLI prints, so a hit reads the same in
37       both places; it is why the meta no longer says "repository" */}}
38  <span class="chip chip-neutral">{{.Kind}}</span>
39  {{if .State}}<span class="chip chip-{{.State}}">{{.State}}</span>{{end}}
40</li>
41{{end}}
42</ul>
43{{/* The count line above already says nothing matched, so this one
44     carries the way out instead of repeating it. */}}
45{{else}}<p class="empty-note">Try fewer words{{if .Kind}}, <a href="?q={{.Query}}">search everything</a>,{{end}} or <a href="/explore">browse the repositories</a>.</p>{{end}}
46{{end}}
47<p class="meta">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>
48</div>
49</div>
50{{end}}