mugit/web/templates/repo_commit.html (view raw)
| 1 | {{ define "_commit_table" }} |
| 2 | <table class="table log"> |
| 3 | <thead> |
| 4 | <tr class="nohover"> |
| 5 | <th class="fill">Message</th> |
| 6 | <th class="author nowrap">Author</th> |
| 7 | <th>Hash</th> |
| 8 | <th class="age nowrap">Age</th> |
| 9 | </tr> |
| 10 | </thead> |
| 11 | <tbody> |
| 12 | {{ range $.Commits }} |
| 13 | <tr> |
| 14 | <td class="fill"> |
| 15 | <a href="/{{ $.Repo }}/commit/{{ .Hash }}"> |
| 16 | {{- if .Message }}{{- commitSummary .Message -}} |
| 17 | {{- else -}}<span class="muted">Empty message</span>{{- end -}} |
| 18 | </a> |
| 19 | </td> |
| 20 | <td class="has-tip nowrap"> |
| 21 | <span class="author-short"> |
| 22 | {{ .AuthorName }} <a href="mailto:{{ .AuthorEmail }}" class="commit-email">{{ .AuthorEmail }}</a> |
| 23 | </span> |
| 24 | <span class="tooltip" role="tooltip"> |
| 25 | <strong>{{ .AuthorName }}</strong><br> |
| 26 | <a href="mailto:{{ .AuthorEmail }}" class="commit-email">{{ .AuthorEmail }}</a> |
| 27 | </span> |
| 28 | </td> |
| 29 | <td class="mono"> |
| 30 | <a href="/{{ $.Repo }}/commit/{{ .Hash }}">{{ .HashShort }}</a> |
| 31 | </td> |
| 32 | <td class="has-tip nowrap"> |
| 33 | {{ humanizeRelTime .Committed }} |
| 34 | <span class="tooltip" role="tooltip">{{ humanizeTime .Committed }}</span> |
| 35 | </td> |
| 36 | </tr> |
| 37 | {{ end }} |
| 38 | </tbody> |
| 39 | </table> |
| 40 | {{ end }} |
| 41 | |
| 42 | {{ define "repo_commit" }} |
| 43 | {{ $commit := .P.Diff.Commit }} |
| 44 | {{ $diff := .P.Diff.Diff }} |
| 45 | {{ $stat := .P.Diff.Stat }} |
| 46 | {{ $parents := .P.Diff.Parents }} |
| 47 | <html> |
| 48 | <head> |
| 49 | {{ template "head" . }} |
| 50 | <title>{{ .RepoName }}: {{ $commit.HashShort }}</title> |
| 51 | </head> |
| 52 | <body> |
| 53 | {{ template "repo_header" . }} |
| 54 | <main> |
| 55 | <section class="commit"> |
| 56 | {{ template "_diff_stat" $stat }} |
| 57 | |
| 58 | <div class="box"> |
| 59 | <pre class="commit-message"> |
| 60 | {{- if $commit.Message }}{{- $commit.Message -}} |
| 61 | {{- else -}}<span class="muted">Empty message</span>{{- end -}} |
| 62 | </pre> |
| 63 | <div> |
| 64 | <strong>Author:</strong> |
| 65 | {{ $commit.AuthorName }} |
| 66 | <a href="mailto:{{ $commit.AuthorEmail }}" class="commit-email">{{ $commit.AuthorEmail }}</a> |
| 67 | </div> |
| 68 | {{ if ne $commit.AuthorEmail $commit.CommitterEmail }} |
| 69 | <div> |
| 70 | <strong>Committed by:</strong> |
| 71 | {{ $commit.CommitterName }} |
| 72 | <a href="mailto:{{ $commit.CommitterEmail }}" class="commit-email">{{ $commit.CommitterEmail }}</a> |
| 73 | </div> |
| 74 | {{ end }} |
| 75 | <div> |
| 76 | <strong>Committed at:</strong> |
| 77 | {{ humanizeTime $commit.Committed }} |
| 78 | </div> |
| 79 | {{ if ne $commit.Authored $commit.Committed }} |
| 80 | <div> |
| 81 | <strong>Authored at:</strong> |
| 82 | {{ humanizeTime $commit.Authored }} |
| 83 | </div> |
| 84 | {{ end }} |
| 85 | {{ if $commit.ChangeID -}} |
| 86 | <div> |
| 87 | <strong>Change ID:</strong> |
| 88 | {{ $commit.ChangeID }} |
| 89 | </div> |
| 90 | {{- end }} |
| 91 | {{ if $parents }} |
| 92 | <div> |
| 93 | <strong>Parent:</strong> |
| 94 | {{ range $i, $p := $parents -}} |
| 95 | {{ if $i }}, {{ end -}} |
| 96 | <a class="link" href="/{{ $.RepoName }}/commit/{{ $p }}">{{ $p }}</a> |
| 97 | {{- end }} |
| 98 | </div> |
| 99 | {{ end }} |
| 100 | </div> |
| 101 | |
| 102 | {{ template "_diff_table" $diff }} |
| 103 | </section> |
| 104 | |
| 105 | <section> |
| 106 | {{ $parent := "" }} |
| 107 | {{ if $parents }}{{ $parent = index $parents 0 }}{{ end }} |
| 108 | {{ template "_diff_files" (dict "Repo" .RepoName "Diff" $diff "RightHash" $commit.Hash "LeftHash" $parent) }} |
| 109 | </section> |
| 110 | </main> |
| 111 | </body> |
| 112 | </html> |
| 113 | {{ end }} |