internal/web/templates/search.html

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

22 lines · 1040 bytes

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