internal/web/templates/search.html

98e6424c9886ae6160a6e939eea39ffd87d5cc75
gitbay/internal/web/templates/search.html history · blame · raw

21 lines · 995 bytes

 1{{define "title"}}search · {{.Repo.OwnerName}}/{{.Repo.Name}}{{end}}
 2{{define "content"}}
 3<h1>Search</h1>
 4<form method="get" action="/{{.Repo.OwnerName}}/{{.Repo.Name}}/search" class="searchform">
 5  <input type="search" name="q" aria-label="Search file contents" value="{{.Query}}" placeholder="search file contents on {{.Ref}}" autofocus>
 6  <button type="submit">search</button>
 7</form>
 8{{if .QueryErr}}<p class="error" role="alert">{{.QueryErr}}</p>
 9{{else if .Query}}
10{{if .Matches}}
11<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>
12<ul class="matchlist">
13{{range .Matches}}<li>
14  <a class="matchpath" href="/{{$.Repo.OwnerName}}/{{$.Repo.Name}}/blob/{{$.Ref}}/{{.Path}}#L{{.Line}}">{{.Path}}:{{.Line}}</a>
15  <pre class="matchline">{{.TextHTML}}</pre>
16</li>
17{{end}}
18</ul>
19{{else}}<p class="empty-note">no matches for “{{.Query}}” on <code>{{.Ref}}</code></p>{{end}}
20{{end}}
21{{end}}