| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-blame"> |
| 3 | <header class="shithub-code-head"> |
| 4 | <nav class="shithub-code-crumbs" aria-label="Breadcrumb"> |
| 5 | {{ range $i, $c := .Crumbs }} |
| 6 | {{ if $i }}<span class="shithub-code-sep">/</span>{{ end }} |
| 7 | <a href="{{ $c.URL }}">{{ $c.Name }}</a> |
| 8 | {{ end }} |
| 9 | </nav> |
| 10 | <div class="shithub-code-actions"> |
| 11 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/blob/{{ .Ref }}/{{ .Path }}" class="shithub-button">View source</a> |
| 12 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/commits/{{ .Ref }}?path={{ .Path }}" class="shithub-button">History</a> |
| 13 | </div> |
| 14 | </header> |
| 15 | |
| 16 | {{ if .TooLarge }} |
| 17 | <div class="shithub-blame-too-large"> |
| 18 | Blame is too expensive for this file. <a href="/{{ .Owner }}/{{ .Repo.Name }}/blob/{{ .Ref }}/{{ .Path }}">View source</a> instead. |
| 19 | </div> |
| 20 | {{ else if .NotBlob }} |
| 21 | <div class="shithub-blame-too-large">Blame requires a regular file.</div> |
| 22 | {{ else }} |
| 23 | <table class="shithub-blame-table"> |
| 24 | <tbody> |
| 25 | {{ range .Chunks }} |
| 26 | <tr class="shithub-blame-chunk-header"> |
| 27 | <td colspan="3"> |
| 28 | {{ if .Author.User }} |
| 29 | <a href="/{{ .Author.Username }}">{{ .Author.DisplayName }}</a> |
| 30 | {{ else }} |
| 31 | <span>{{ .Chunk.AuthorName }}</span> |
| 32 | {{ end }} |
| 33 | <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ .Chunk.OID }}"><code>{{ .Chunk.ShortOID }}</code></a> |
| 34 | <time datetime="{{ .Chunk.AuthorWhen.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .Chunk.AuthorWhen }}</time> |
| 35 | </td> |
| 36 | </tr> |
| 37 | {{ range .Chunk.Lines }} |
| 38 | <tr id="L{{ .FinalLineNo }}"> |
| 39 | <td class="shithub-blame-lineno"><a href="#L{{ .FinalLineNo }}">{{ .FinalLineNo }}</a></td> |
| 40 | <td class="shithub-blame-content"><pre>{{ .Content }}</pre></td> |
| 41 | </tr> |
| 42 | {{ end }} |
| 43 | {{ end }} |
| 44 | </tbody> |
| 45 | </table> |
| 46 | {{ end }} |
| 47 | </section> |
| 48 | {{- end }} |