internal/web/templates/search.html
cmc web: polish remaining repo sub-views, snippets/queries, and auth/landing pages
28e72be7ab 1 day ago26 lines · 1193 bytes
1{{define "width"}}wide{{end}}
2{{define "title"}}search · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
3{{define "content"}}
4<div class="pagehead">
5 <h1>Search code</h1>
6 <span class="grow"></span>
7 <a class="button btn" href="/{{.Repo.OwnerName}}/{{.Repo.Name}}/symbols">Symbols</a>
8</div>
9<form method="get" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/search" class="searchform">
10 <input type="search" name="q" aria-label="Search file contents" value="{{.Query}}" placeholder="search file contents on {{.Ref}}">
11 <button type="submit" class="btn">Search</button>
12</form>
13{{if .QueryErr}}<p class="error" role="alert">{{.QueryErr}}</p>
14{{else if .Query}}
15{{if .Matches}}
16<p class="meta">{{len .Matches}} match{{if ne (len .Matches) 1}}es{{end}}{{if .Capped}} (capped — refine the query){{end}} on <code>{{.Ref}}</code></p>
17<ul class="matchlist">
18{{range .Matches}}<li>
19 <a class="matchpath" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/blob/{{$.Ref}}/{{.Path}}#L{{.Line}}">{{.Path}}:{{.Line}}</a>
20 <pre class="matchline" tabindex="0">{{.TextHTML}}</pre>
21</li>
22{{end}}
23</ul>
24{{else}}<p class="empty-note">no matches for “{{.Query}}” on <code>{{.Ref}}</code></p>{{end}}
25{{end}}
26{{end}}