| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-finder"> |
| 3 | <header> |
| 4 | <h1>Find file in <a href="/{{ .Owner }}/{{ .Repo.Name }}/tree/{{ .Ref }}">{{ .Owner }}/{{ .Repo.Name }}@{{ .Ref }}</a></h1> |
| 5 | <form method="GET" action="/{{ .Owner }}/{{ .Repo.Name }}/find/{{ .Ref }}" class="shithub-finder-form"> |
| 6 | <label>Filter <input type="text" name="q" value="{{ .Query }}" autofocus placeholder="type to filter"></label> |
| 7 | <button type="submit" class="shithub-button">Search</button> |
| 8 | </form> |
| 9 | </header> |
| 10 | {{ if .Matches }} |
| 11 | <ul class="shithub-finder-results"> |
| 12 | {{ range .Matches }} |
| 13 | <li><a href="/{{ $.Owner }}/{{ $.Repo.Name }}/blob/{{ $.Ref }}/{{ .Path }}">{{ .Path }}</a></li> |
| 14 | {{ end }} |
| 15 | </ul> |
| 16 | {{ else if .Query }} |
| 17 | <p>No files match <code>{{ .Query }}</code>.</p> |
| 18 | {{ else }} |
| 19 | <p>Type a query to filter the tree.</p> |
| 20 | {{ end }} |
| 21 | </section> |
| 22 | {{- end }} |