| 1 | {{ define "page" -}} |
| 2 | <section class="shithub-commit-view"> |
| 3 | <header class="shithub-code-head"> |
| 4 | <h1> |
| 5 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/tree/{{ .Detail.OID }}">{{ .Owner }}/{{ .Repo.Name }}</a> |
| 6 | <span class="shithub-code-sep">/</span> |
| 7 | <code>{{ .Detail.ShortOID }}</code> |
| 8 | </h1> |
| 9 | <a href="/{{ .Owner }}/{{ .Repo.Name }}/tree/{{ .Detail.TreeOID }}" class="shithub-button">Browse files</a> |
| 10 | </header> |
| 11 | |
| 12 | <article class="shithub-commit-meta"> |
| 13 | <h2 class="shithub-commit-subject"> |
| 14 | {{ .Detail.Subject }} |
| 15 | {{ template "verified-badge" .Verification }} |
| 16 | </h2> |
| 17 | {{ if .Detail.Body }}<div class="shithub-commit-body">{{ .BodyHTML }}</div>{{ end }} |
| 18 | |
| 19 | <div class="shithub-commit-people"> |
| 20 | <div class="shithub-commit-actor"> |
| 21 | <span class="shithub-commit-role">Authored by</span> |
| 22 | {{ if .Author.User }} |
| 23 | <a href="/{{ .Author.Username }}"><img src="{{ .Author.AvatarURL }}" alt="" class="shithub-avatar-sm"></a> |
| 24 | <a href="/{{ .Author.Username }}">{{ .Author.DisplayName }}</a> |
| 25 | {{ else }} |
| 26 | <span class="shithub-avatar-sm shithub-identicon" data-seed="{{ .Author.IdenticonSeed }}" aria-hidden="true"></span> |
| 27 | <span>{{ .Detail.AuthorName }} <{{ .Detail.AuthorEmail }}></span> |
| 28 | {{ end }} |
| 29 | <time datetime="{{ .Detail.AuthorWhen.Format "2006-01-02T15:04:05Z" }}">{{ relativeTime .Detail.AuthorWhen }}</time> |
| 30 | </div> |
| 31 | {{ if ne .Detail.CommitterEmail .Detail.AuthorEmail }} |
| 32 | <div class="shithub-commit-actor"> |
| 33 | <span class="shithub-commit-role">Committed by</span> |
| 34 | {{ if .Committer.User }} |
| 35 | <a href="/{{ .Committer.Username }}">{{ .Committer.DisplayName }}</a> |
| 36 | {{ else }} |
| 37 | <span>{{ .Detail.CommitterName }}</span> |
| 38 | {{ end }} |
| 39 | </div> |
| 40 | {{ end }} |
| 41 | </div> |
| 42 | |
| 43 | <dl class="shithub-commit-refs"> |
| 44 | <dt>SHA</dt><dd><code>{{ .Detail.OID }}</code></dd> |
| 45 | {{ if .Detail.Parents }} |
| 46 | <dt>Parents</dt> |
| 47 | <dd> |
| 48 | {{ range .Detail.Parents }} |
| 49 | <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/commit/{{ . }}"><code>{{ slice . 0 7 }}</code></a> |
| 50 | {{ end }} |
| 51 | </dd> |
| 52 | {{ end }} |
| 53 | <dt>Tree</dt> |
| 54 | <dd><a href="/{{ .Owner }}/{{ .Repo.Name }}/tree/{{ .Detail.OID }}"><code>{{ slice .Detail.TreeOID 0 7 }}</code></a></dd> |
| 55 | </dl> |
| 56 | </article> |
| 57 | |
| 58 | <section class="shithub-commit-files"> |
| 59 | <header class="shithub-commit-files-head"> |
| 60 | <h3>{{ len .Detail.Files }} changed file{{ if ne (len .Detail.Files) 1 }}s{{ end }}</h3> |
| 61 | <nav class="shithub-diff-toggles" aria-label="Diff options"> |
| 62 | <a href="?diff=unified{{ if .HideWS }}&w=1{{ end }}" class="shithub-button {{ if eq .DiffMode "unified" }}shithub-button-primary{{ end }}">Unified</a> |
| 63 | <a href="?diff=split{{ if .HideWS }}&w=1{{ end }}" class="shithub-button {{ if eq .DiffMode "split" }}shithub-button-primary{{ end }}">Split</a> |
| 64 | <a href="?diff={{ .DiffMode }}{{ if not .HideWS }}&w=1{{ end }}" class="shithub-button {{ if .HideWS }}shithub-button-primary{{ end }}">Hide whitespace</a> |
| 65 | </nav> |
| 66 | </header> |
| 67 | <table class="shithub-commit-files-table"> |
| 68 | <thead> |
| 69 | <tr><th>Status</th><th>File</th><th class="shithub-num-col">+</th><th class="shithub-num-col">-</th></tr> |
| 70 | </thead> |
| 71 | <tbody> |
| 72 | {{ range .Detail.Files }} |
| 73 | <tr> |
| 74 | <td><span class="shithub-status-{{ .Status }}">{{ .Status }}</span></td> |
| 75 | <td> |
| 76 | {{ if eq .Status "R" }}<code>{{ .OldPath }}</code> → {{ end }} |
| 77 | <a href="/{{ $.Owner }}/{{ $.Repo.Name }}/blob/{{ $.Detail.OID }}/{{ .Path }}"><code>{{ .Path }}</code></a> |
| 78 | </td> |
| 79 | <td class="shithub-num-col shithub-add">{{ if .Binary }}bin{{ else }}{{ .Insert }}{{ end }}</td> |
| 80 | <td class="shithub-num-col shithub-del">{{ if .Binary }}{{ else }}{{ .Delete }}{{ end }}</td> |
| 81 | </tr> |
| 82 | {{ end }} |
| 83 | </tbody> |
| 84 | </table> |
| 85 | </section> |
| 86 | |
| 87 | {{ if .DiffHTML }} |
| 88 | <section class="shithub-diff-body" aria-label="Per-file diff"> |
| 89 | {{ .DiffHTML }} |
| 90 | </section> |
| 91 | {{ end }} |
| 92 | </section> |
| 93 | {{- end }} |