commit.html
·
101 lines
·
4.3 KB
| 1 | {{define "content"}} |
| 2 | <div class="container"> |
| 3 | {{template "repo_header" .}} |
| 4 | |
| 5 | <div class="card mb-4"> |
| 6 | <div class="card-header flex items-center justify-between flex-wrap gap-2"> |
| 7 | <div class="flex items-center gap-2 min-w-0"> |
| 8 | {{icon "git-commit" "size-4"}} |
| 9 | <h1 class="text-base font-semibold truncate" style="margin:0;">{{.Detail.Commit.Subject}}</h1> |
| 10 | </div> |
| 11 | <div class="flex items-center gap-1.5 font-mono text-xs"> |
| 12 | <span class="badge badge-outline">{{.Detail.Commit.ShortHash}}</span> |
| 13 | <button type="button" class="btn btn-ghost btn-icon" style="width:1.7rem;height:1.7rem;" data-copy="{{.Detail.Commit.Hash}}" aria-label="{{t .Lang "common.copy"}}"> |
| 14 | {{icon "copy" "size-3.5"}} |
| 15 | </button> |
| 16 | <a href="/{{.Repo.OwnerUsername}}/{{.Repo.Name}}/tree/{{.Detail.Commit.Hash}}" class="btn btn-outline btn-sm">{{t .Lang "repo.browse_at_commit"}}</a> |
| 17 | </div> |
| 18 | </div> |
| 19 | |
| 20 | {{if .Detail.Commit.Body}} |
| 21 | <div class="card-body" style="border-bottom:1px solid hsl(var(--border));background:hsl(var(--muted)/0.25);"> |
| 22 | <pre class="font-mono text-xs" style="margin:0;white-space:pre-wrap;">{{.Detail.Commit.Body}}</pre> |
| 23 | </div> |
| 24 | {{end}} |
| 25 | |
| 26 | <div class="card-body flex items-center justify-between flex-wrap gap-3 text-xs text-muted" style="padding:0.6rem 0.9rem;"> |
| 27 | <div class="flex items-center gap-2"> |
| 28 | <span class="avatar" style="width:1.35rem;height:1.35rem;font-size:0.62rem;">{{avatarInitial .Detail.Commit.AuthorName}}</span> |
| 29 | <span class="font-medium" style="color:hsl(var(--foreground));">{{.Detail.Commit.AuthorName}}</span> |
| 30 | <span>·</span> |
| 31 | <span>{{formatDate .Detail.Commit.AuthoredAt}}</span> |
| 32 | </div> |
| 33 | |
| 34 | <div class="flex items-center gap-3 font-mono"> |
| 35 | <span><strong>{{.Detail.FilesChanged}}</strong> {{pluralT .Lang .Detail.FilesChanged "repo.files_changed"}}</span> |
| 36 | <span style="color:hsl(var(--diff-add-fg));">+{{.Detail.TotalAdditions}}</span> |
| 37 | <span style="color:hsl(var(--diff-del-fg));">-{{.Detail.TotalDeletions}}</span> |
| 38 | </div> |
| 39 | </div> |
| 40 | </div> |
| 41 | |
| 42 | <div class="flex flex-col gap-4"> |
| 43 | {{range .Detail.Files}} |
| 44 | <section class="card"> |
| 45 | <div class="card-header" style="padding:0.5rem 0.8rem;"> |
| 46 | <div class="flex items-center gap-2 font-mono text-xs min-w-0"> |
| 47 | {{icon "file-code" "size-4"}} |
| 48 | {{if eq .Status "renamed"}} |
| 49 | <span>{{.OldPath}} → <strong>{{.NewPath}}</strong></span> |
| 50 | {{else}} |
| 51 | <strong>{{.NewPath}}</strong> |
| 52 | {{end}} |
| 53 | </div> |
| 54 | <div class="flex items-center gap-2 font-mono text-xs"> |
| 55 | <span style="color:hsl(var(--diff-add-fg));">+{{.Additions}}</span> |
| 56 | <span style="color:hsl(var(--diff-del-fg));">-{{.Deletions}}</span> |
| 57 | </div> |
| 58 | </div> |
| 59 | |
| 60 | {{if .IsBinary}} |
| 61 | <div class="card-body text-xs text-muted">{{t $.Lang "repo.binary_notice"}}</div> |
| 62 | {{else}} |
| 63 | <div style="overflow-x:auto;"> |
| 64 | <table class="diff-table"> |
| 65 | <tbody> |
| 66 | {{range .Lines}} |
| 67 | {{if eq .Type "hunk"}} |
| 68 | <tr class="diff-row-hunk"> |
| 69 | <td class="diff-num">...</td> |
| 70 | <td class="diff-num">...</td> |
| 71 | <td class="diff-code">{{.Content}}</td> |
| 72 | </tr> |
| 73 | {{else if eq .Type "add"}} |
| 74 | <tr class="diff-row-add"> |
| 75 | <td class="diff-num"></td> |
| 76 | <td class="diff-num">{{.NewNum}}</td> |
| 77 | <td class="diff-code">+{{.Content}}</td> |
| 78 | </tr> |
| 79 | {{else if eq .Type "del"}} |
| 80 | <tr class="diff-row-del"> |
| 81 | <td class="diff-num">{{.OldNum}}</td> |
| 82 | <td class="diff-num"></td> |
| 83 | <td class="diff-code">-{{.Content}}</td> |
| 84 | </tr> |
| 85 | {{else}} |
| 86 | <tr> |
| 87 | <td class="diff-num">{{.OldNum}}</td> |
| 88 | <td class="diff-num">{{.NewNum}}</td> |
| 89 | <td class="diff-code"> {{.Content}}</td> |
| 90 | </tr> |
| 91 | {{end}} |
| 92 | {{end}} |
| 93 | </tbody> |
| 94 | </table> |
| 95 | </div> |
| 96 | {{end}} |
| 97 | </section> |
| 98 | {{end}} |
| 99 | </div> |
| 100 | </div> |
| 101 | {{end}} |