| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-search-page"> |
| 3 | <div class="shithub-search-shell"> |
| 4 | <aside class="shithub-search-sidebar" aria-label="Search filters"> |
| 5 | <h2 id="search-filters-title">Filter by</h2> |
| 6 | <nav class="shithub-search-filter-list" aria-labelledby="search-filters-title"> |
| 7 | {{ range .SearchTabs }} |
| 8 | <a href="{{ .Href }}" class="shithub-search-filter{{ if .Selected }} is-selected{{ end }}"{{ if .Selected }} aria-current="page"{{ end }}> |
| 9 | <span class="shithub-search-filter-label">{{ octicon .Icon }} {{ .Label }}</span> |
| 10 | <span class="shithub-search-filter-count">{{ if .Count }}{{ .Count }}{{ else }}0{{ end }}</span> |
| 11 | </a> |
| 12 | {{ end }} |
| 13 | </nav> |
| 14 | </aside> |
| 15 | |
| 16 | <div class="shithub-search-results"> |
| 17 | <form action="/search" method="get" class="shithub-search-query-form"> |
| 18 | <label class="sr-only" for="search-page-query">Search query</label> |
| 19 | <input id="search-page-query" type="text" name="q" value="{{ .Query }}" placeholder="Search shithub" autofocus> |
| 20 | <input type="hidden" name="type" value="{{ .Tab }}"> |
| 21 | <button type="submit" class="shithub-button shithub-button-primary">Search</button> |
| 22 | </form> |
| 23 | |
| 24 | {{ if .EmptyQuery }} |
| 25 | <div class="shithub-search-blank"> |
| 26 | <h1>Search shithub</h1> |
| 27 | <p>Enter a query above to find repositories, code, issues, pull requests, and users.</p> |
| 28 | </div> |
| 29 | {{ else }} |
| 30 | <div class="shithub-search-results-head"> |
| 31 | <div> |
| 32 | <h1>{{ .ResultHeading }}</h1> |
| 33 | <p>for <span class="shithub-search-query-echo">{{ .Query }}</span></p> |
| 34 | </div> |
| 35 | <details class="shithub-search-sort"> |
| 36 | <summary>Sort: Best match</summary> |
| 37 | <div role="menu"> |
| 38 | <span role="menuitem">Best match</span> |
| 39 | <span role="menuitem" aria-disabled="true">Most recently updated</span> |
| 40 | </div> |
| 41 | </details> |
| 42 | </div> |
| 43 | |
| 44 | {{ if eq .Tab "repositories" }} |
| 45 | {{ if .Repos }} |
| 46 | <ol class="shithub-search-result-list"> |
| 47 | {{ range .Repos }} |
| 48 | <li class="shithub-search-result shithub-search-repo-result"> |
| 49 | <div class="shithub-search-result-main"> |
| 50 | <h2 class="shithub-search-result-title"> |
| 51 | <img src="/avatars/{{ .OwnerUsername }}" alt="" width="20" height="20" class="shithub-search-avatar"> |
| 52 | <a href="/{{ .OwnerUsername }}/{{ .Name }}"><span class="shithub-search-match">{{ .OwnerUsername }}/{{ .Name }}</span></a> |
| 53 | {{ if eq .Visibility "private" }}<span class="shithub-pill shithub-pill-private">Private</span>{{ end }} |
| 54 | </h2> |
| 55 | {{ if .Description }}<p class="shithub-search-result-desc">{{ .Description }}</p>{{ end }} |
| 56 | <ul class="shithub-search-result-meta"> |
| 57 | <li><a href="/{{ .OwnerUsername }}/{{ .Name }}/stargazers">{{ octicon "star" }} {{ .StarCount }}</a></li> |
| 58 | <li>Updated {{ relativeTime .UpdatedAt }}</li> |
| 59 | </ul> |
| 60 | </div> |
| 61 | <a href="/{{ .OwnerUsername }}/{{ .Name }}/stargazers" class="shithub-button shithub-button-small shithub-search-star">{{ octicon "star" }} Star</a> |
| 62 | </li> |
| 63 | {{ end }} |
| 64 | </ol> |
| 65 | {{ else }}<p class="shithub-search-empty">No repositories matched your search.</p>{{ end }} |
| 66 | |
| 67 | {{ else if eq .Tab "issues" }} |
| 68 | {{ if .Issues }} |
| 69 | <ol class="shithub-search-result-list"> |
| 70 | {{ range .Issues }} |
| 71 | <li class="shithub-search-result"> |
| 72 | <div class="shithub-search-result-main"> |
| 73 | <p class="shithub-search-result-context"><a href="/{{ .OwnerUsername }}/{{ .RepoName }}">{{ .OwnerUsername }}/{{ .RepoName }}</a></p> |
| 74 | <h2 class="shithub-search-result-title"> |
| 75 | <span class="shithub-search-state shithub-search-state-{{ .State }}"> |
| 76 | {{ if eq .State "closed" }}{{ octicon "issue-closed" }}{{ else }}{{ octicon "issue-opened" }}{{ end }} |
| 77 | </span> |
| 78 | <a href="/{{ .OwnerUsername }}/{{ .RepoName }}/issues/{{ .Number }}"><span class="shithub-search-match">{{ .Title }}</span></a> |
| 79 | </h2> |
| 80 | <ul class="shithub-search-result-meta"> |
| 81 | {{ if .AuthorName }}<li><img src="/avatars/{{ .AuthorName }}" alt="" width="16" height="16" class="shithub-search-mini-avatar"> {{ .AuthorName }}</li>{{ end }} |
| 82 | <li>{{ .State }}</li> |
| 83 | <li>Updated {{ relativeTime .UpdatedAt }}</li> |
| 84 | <li><a href="/{{ .OwnerUsername }}/{{ .RepoName }}/issues/{{ .Number }}">#{{ .Number }}</a></li> |
| 85 | </ul> |
| 86 | </div> |
| 87 | </li> |
| 88 | {{ end }} |
| 89 | </ol> |
| 90 | {{ else }}<p class="shithub-search-empty">No issues matched your search.</p>{{ end }} |
| 91 | |
| 92 | {{ else if eq .Tab "pullrequests" }} |
| 93 | {{ if .Issues }} |
| 94 | <ol class="shithub-search-result-list"> |
| 95 | {{ range .Issues }} |
| 96 | <li class="shithub-search-result"> |
| 97 | <div class="shithub-search-result-main"> |
| 98 | <p class="shithub-search-result-context"><a href="/{{ .OwnerUsername }}/{{ .RepoName }}">{{ .OwnerUsername }}/{{ .RepoName }}</a></p> |
| 99 | <h2 class="shithub-search-result-title"> |
| 100 | <span class="shithub-search-state shithub-search-state-pr">{{ octicon "git-pull-request" }}</span> |
| 101 | <a href="/{{ .OwnerUsername }}/{{ .RepoName }}/pulls/{{ .Number }}"><span class="shithub-search-match">{{ .Title }}</span></a> |
| 102 | </h2> |
| 103 | <ul class="shithub-search-result-meta"> |
| 104 | {{ if .AuthorName }}<li><img src="/avatars/{{ .AuthorName }}" alt="" width="16" height="16" class="shithub-search-mini-avatar"> {{ .AuthorName }}</li>{{ end }} |
| 105 | <li>{{ .State }}</li> |
| 106 | <li>Updated {{ relativeTime .UpdatedAt }}</li> |
| 107 | <li><a href="/{{ .OwnerUsername }}/{{ .RepoName }}/pulls/{{ .Number }}">#{{ .Number }}</a></li> |
| 108 | </ul> |
| 109 | </div> |
| 110 | </li> |
| 111 | {{ end }} |
| 112 | </ol> |
| 113 | {{ else }}<p class="shithub-search-empty">No pull requests matched your search.</p>{{ end }} |
| 114 | |
| 115 | {{ else if eq .Tab "users" }} |
| 116 | {{ if .Users }} |
| 117 | <ol class="shithub-search-result-list"> |
| 118 | {{ range .Users }} |
| 119 | <li class="shithub-search-result shithub-search-user-result"> |
| 120 | <img src="/avatars/{{ .Username }}" alt="" width="48" height="48" class="shithub-search-user-avatar"> |
| 121 | <div class="shithub-search-result-main"> |
| 122 | <h2 class="shithub-search-result-title"> |
| 123 | <a href="/{{ .Username }}">{{ if .DisplayName }}{{ .DisplayName }}{{ else }}{{ .Username }}{{ end }}</a> |
| 124 | <span class="shithub-search-user-login">{{ .Username }}</span> |
| 125 | </h2> |
| 126 | {{ if .Bio }}<p class="shithub-search-result-desc">{{ .Bio }}</p>{{ end }} |
| 127 | </div> |
| 128 | </li> |
| 129 | {{ end }} |
| 130 | </ol> |
| 131 | {{ else }}<p class="shithub-search-empty">No users matched your search.</p>{{ end }} |
| 132 | |
| 133 | {{ else if eq .Tab "code" }} |
| 134 | {{ if .Code }} |
| 135 | <ol class="shithub-search-result-list"> |
| 136 | {{ range .Code }} |
| 137 | <li class="shithub-search-result"> |
| 138 | <div class="shithub-search-result-main"> |
| 139 | <p class="shithub-search-result-context"><a href="/{{ .OwnerUsername }}/{{ .RepoName }}">{{ .OwnerUsername }}/{{ .RepoName }}</a></p> |
| 140 | <h2 class="shithub-search-result-title"> |
| 141 | {{ octicon "file" }} |
| 142 | <a href="/{{ .OwnerUsername }}/{{ .RepoName }}/blob/{{ .RefName }}/{{ .Path }}"><span class="shithub-search-match">{{ .Path }}</span></a> |
| 143 | </h2> |
| 144 | <p class="shithub-search-result-path">on {{ .RefName }}</p> |
| 145 | {{ if .PreviewLine }}<pre class="shithub-search-code-preview"><code>{{ .PreviewLine }}</code></pre>{{ end }} |
| 146 | </div> |
| 147 | </li> |
| 148 | {{ end }} |
| 149 | </ol> |
| 150 | {{ else }}<p class="shithub-search-empty">No code matched your search.</p>{{ end }} |
| 151 | {{ end }} |
| 152 | |
| 153 | {{ if or .HasPrev .HasNext }} |
| 154 | <nav class="shithub-search-pagination" aria-label="Pagination"> |
| 155 | {{ if .HasPrev }}<a href="{{ .PrevHref }}" class="shithub-button">Previous</a>{{ else }}<span class="shithub-button shithub-button-disabled" aria-disabled="true">Previous</span>{{ end }} |
| 156 | {{ if .HasNext }}<a href="{{ .NextHref }}" class="shithub-button">Next</a>{{ else }}<span class="shithub-button shithub-button-disabled" aria-disabled="true">Next</span>{{ end }} |
| 157 | </nav> |
| 158 | {{ end }} |
| 159 | {{ end }} |
| 160 | </div> |
| 161 | |
| 162 | <aside class="shithub-search-rightbar" aria-label="Search tips"> |
| 163 | <div class="shithub-search-tip-card"> |
| 164 | <strong>{{ octicon "search" }} ProTip!</strong> |
| 165 | <p>{{ .SearchProTip }}</p> |
| 166 | </div> |
| 167 | <div class="shithub-search-tip-card"> |
| 168 | <strong>Search syntax tips</strong> |
| 169 | <ul> |
| 170 | <li><code>repo:owner/name</code></li> |
| 171 | <li><code>is:open</code></li> |
| 172 | <li><code>author:username</code></li> |
| 173 | </ul> |
| 174 | </div> |
| 175 | </aside> |
| 176 | </div> |
| 177 | </section> |
| 178 | {{- end }} |