Skip to content

Commit 71a17ef

Browse files
committed
fix
1 parent aae3308 commit 71a17ef

File tree

14 files changed

+171
-491
lines changed

14 files changed

+171
-491
lines changed

templates/repo/commit_page.tmpl

Lines changed: 51 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
{{template "base/head" .}}
2-
{{$hashLinkSubPath := ""}}
3-
{{if $.PageIsWiki}}
4-
{{$hashLinkSubPath := "/wiki"}}
5-
{{end}}
2+
{{$commitLinkBase := print $.RepoLink (Iif $.PageIsWiki "/wiki" "") "/commit"}}
63
<div role="main" aria-label="{{.Title}}" class="page-content repository diff">
74
{{template "repo/header" .}}
85
<div class="ui container fluid padded">
96
<div class="ui top attached header clearing segment tw-relative commit-header">
107
<div class="tw-flex tw-mb-4 tw-gap-1">
11-
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary tw-break-anywhere" title="{{.Commit.Summary}}">{{RenderCommitMessage $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
8+
<h3 class="tw-mb-0 tw-flex-1"><span class="commit-summary" title="{{.Commit.Summary}}">{{ctx.RenderUtils.RenderCommitMessage .Commit.Message ($.Repository.ComposeMetas ctx)}}</span>{{template "repo/commit_statuses" dict "Status" .CommitStatus "Statuses" .CommitStatuses}}</h3>
129
{{if not $.PageIsWiki}}
1310
<div class="commit-header-buttons">
1411
<a class="ui primary tiny button" href="{{.SourcePath}}">
@@ -131,49 +128,59 @@
131128
{{end}}
132129
{{template "repo/commit_load_branches_and_tags" .}}
133130
</div>
134-
<div class="ui bottom attached segment tw-flex tw-items-center tw-justify-between tw-py-1 commit-header-row tw-flex-wrap">
135-
<div class="author tw-flex tw-items-center tw-gap-1">
136-
{{if .Author}}
137-
{{ctx.AvatarUtils.Avatar .Author 20}}
138-
{{if .Author.FullName}}
139-
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
140-
{{else}}
141-
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
142-
{{end}}
131+
132+
<div class="ui bottom attached segment flex-text-block tw-flex-wrap">
133+
<div class="flex-text-inline">
134+
{{if .Author}}
135+
{{ctx.AvatarUtils.Avatar .Author 20}}
136+
{{if .Author.FullName}}
137+
<a href="{{.Author.HomeLink}}"><strong>{{.Author.FullName}}</strong></a>
143138
{{else}}
144-
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}}
145-
<strong>{{.Commit.Author.Name}}</strong>
146-
{{end}}
147-
<span class="text grey tw-ml-2" id="authored-time">{{DateUtils.TimeSince .Commit.Author.When}}</span>
148-
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
149-
<span class="text grey">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
150-
{{if ne .Verification.CommittingUser.ID 0}}
151-
{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 20}}
152-
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
153-
{{else}}
154-
{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 20}}
155-
<strong>{{.Commit.Committer.Name}}</strong>
156-
{{end}}
157-
{{end}}
158-
{{if .Commit.Signature}}
159-
{{template "repo/signature_badge" dict "root" $ "verification" .Verification "shortsha" (ShortSha .Commit.ID.String)}}
139+
<a href="{{.Author.HomeLink}}"><strong>{{.Commit.Author.Name}}</strong></a>
160140
{{end}}
161-
</div>
162-
<div class="tw-flex tw-items-center tw-gap-5 tw-py-3">
163-
{{if .Parents}}
164-
<div class="tw-flex tw-gap-2">
165-
<span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
166-
{{range .Parents}}
167-
<a class="commit-hash-link" href="{{$.RepoLink}}{{$hashLinkSubPath}}/commit/{{PathEscape .}}">{{ShortSha .}}</a>
168-
{{end}}
169-
</div>
141+
{{else}}
142+
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}}
143+
<strong>{{.Commit.Author.Name}}</strong>
144+
{{end}}
145+
</div>
146+
147+
<span class="text grey">{{DateUtils.TimeSince .Commit.Author.When}}</span>
148+
149+
<div class="flex-text-inline">
150+
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
151+
<span class="text grey">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
152+
{{if ne .Verification.CommittingUser.ID 0}}
153+
{{ctx.AvatarUtils.Avatar .Verification.CommittingUser 20}}
154+
<a href="{{.Verification.CommittingUser.HomeLink}}"><strong>{{.Commit.Committer.Name}}</strong></a>
155+
{{else}}
156+
{{ctx.AvatarUtils.AvatarByEmail .Commit.Committer.Email .Commit.Committer.Name 20}}
157+
<strong>{{.Commit.Committer.Name}}</strong>
170158
{{end}}
171-
<div class="tw-flex tw-gap-2">
172-
<span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
173-
<a class="commit-hash-link" href="{{$.RepoLink}}{{$hashLinkSubPath}}/commit/{{PathEscape .CommitID}}">{{ShortSha .CommitID}}</a>
159+
{{end}}
160+
</div>
161+
162+
{{if .Verification}}
163+
{{template "repo/signature_badge" dict "CommitSignVerification" .Verification}}
164+
{{end}}
165+
166+
<div class="tw-flex-1"></div>
167+
168+
<div class="flex-text-inline tw-gap-5">
169+
{{if .Parents}}
170+
<div class="flex-text-inline">
171+
<span>{{ctx.Locale.Tr "repo.diff.parent"}}</span>
172+
{{range .Parents}}
173+
<a class="ui label commit-id-short" href="{{$commitLinkBase}}/{{PathEscape .}}">{{ShortSha .}}</a>
174+
{{end}}
174175
</div>
176+
{{end}}
177+
<div class="flex-text-inline">
178+
<span>{{ctx.Locale.Tr "repo.diff.commit"}}</span>
179+
<a class="ui label commit-id-short" href="{{$commitLinkBase}}/{{PathEscape .CommitID}}">{{ShortSha .CommitID}}</a>
175180
</div>
181+
</div>
176182
</div>
183+
177184
{{if .NoteRendered}}
178185
<div class="ui top attached header segment git-notes">
179186
{{svg "octicon-note" 16 "tw-mr-2"}}
@@ -189,12 +196,13 @@
189196
{{else}}
190197
<strong>{{.NoteCommit.Author.Name}}</strong>
191198
{{end}}
192-
<span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
199+
<span class="text grey">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
193200
</div>
194201
<div class="ui bottom attached info segment git-notes">
195202
<pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>
196203
</div>
197204
{{end}}
205+
198206
{{template "repo/diff/box" .}}
199207
</div>
200208
</div>

templates/repo/commits_list.tmpl

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,6 @@
2929
</div>
3030
</td>
3131
<td class="sha">
32-
{{$class := "ui sha label"}}
33-
{{if .Signature}}
34-
{{$class = (print $class " isSigned")}}
35-
{{if .Verification.Verified}}
36-
{{if eq .Verification.TrustStatus "trusted"}}
37-
{{$class = (print $class " isVerified")}}
38-
{{else if eq .Verification.TrustStatus "untrusted"}}
39-
{{$class = (print $class " isVerifiedUntrusted")}}
40-
{{else}}
41-
{{$class = (print $class " isVerifiedUnmatched")}}
42-
{{end}}
43-
{{else if .Verification.Warning}}
44-
{{$class = (print $class " isWarning")}}
45-
{{end}}
46-
{{end}}
4732
{{$commitShaLink := ""}}
4833
{{if $.PageIsWiki}}
4934
{{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
@@ -52,10 +37,10 @@
5237
{{else if $.Reponame}}
5338
{{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
5439
{{end}}
55-
<a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="{{$class}}">
56-
<span class="shortsha">{{ShortSha .ID.String}}</span>
57-
{{if .Signature}}{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}{{end}}
58-
</a>
40+
<a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="ui label commit-id-short">{{ShortSha .ID.String}}</a>
41+
{{if .Verification}}
42+
{{template "repo/signature_badge" dict "CommitSignVerification" .Verification}}
43+
{{end}}
5944
</td>
6045
<td class="message">
6146
<span class="message-wrapper">

templates/repo/commits_list_small.tmpl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
{{range .comment.Commits}}
44
{{$tag := printf "%s-%d" $.comment.HashTag $index}}
55
{{$index = Eval $index "+" 1}}
6-
<div class="singular-commit" id="{{$tag}}">
6+
<div class="flex-text-block" id="{{$tag}}">{{/*singular-commit*/}}
77
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
88
{{if .User}}
99
<a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}}</a>
@@ -23,10 +23,10 @@
2323

2424
<span class="tw-flex tw-items-center tw-gap-2">
2525
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
26-
{{if .Signature}}
27-
{{template "repo/signature_badge" dict "root" $.root "verification" .Verification}}
26+
<a href="{{$commitLink}}" rel="nofollow" class="ui label commit-id-short">{{ShortSha .ID.String}}</a>
27+
{{if .Verification}}
28+
{{template "repo/signature_badge" dict "CommitSignVerification" .Verification}}
2829
{{end}}
29-
<a href="{{$commitLink}}" rel="nofollow" class="commit-hash-link tw-p-2 hover:tw-bg-hover hover:tw-no-underline tw-rounded-lg">{{ShortSha .ID.String}}</a>
3030
</span>
3131
</div>
3232
{{if IsMultilineCommitMessage .Message}}

templates/repo/diff/section_unified.tmpl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
{{$file := .file}}
2-
{{$blobExcerptLink := print (or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink) (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $.root.AfterCommitID) "?"}}
2+
{{$repoLink := or ctx.RootData.CommitRepoLink ctx.RootData.RepoLink}}
3+
{{$afterCommitID := or $.root.AfterCommitID "no-after-commit-id"}}{{/* this tmpl is also used by the PR Conversation page, so the "AfterCommitID" may not exist */}}
4+
{{$blobExcerptLink := print $repoLink (Iif $.root.PageIsWiki "/wiki" "") "/blob_excerpt/" (PathEscape $afterCommitID) "?"}}
35
<colgroup>
46
<col width="50">
57
<col width="50">

templates/repo/graph/commits.tmpl

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,17 @@
55
{{if $commit.OnlyRelation}}
66
<span></span>
77
{{else}}
8-
<span id="{{$commit.ShortRev}}">
9-
<a href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow" class="commit-hash-link">{{ShortSha $commit.Commit.ID.String}}</a>
10-
</span>
11-
{{- if $commit.Commit.Signature -}}
12-
<span class="tw-leading-5">
13-
{{template "repo/signature_badge" dict "root" $ "verification" $commit.Verification "shortsha" (ShortSha $commit.Commit.ID.String)}}
14-
</span>
8+
<a class="ui label commit-id-short" href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow">{{ShortSha $commit.Commit.ID.String}}</a>
9+
10+
{{- if $commit.Verification -}}
11+
{{template "repo/signature_badge" dict "CommitSignVerification" $commit.Verification}}
1512
{{- end -}}
16-
<span class="message tw-inline-block gt-ellipsis tw-mr-2">
13+
14+
<span class="message tw-inline-block gt-ellipsis">
1715
<span>{{ctx.RenderUtils.RenderCommitMessage $commit.Subject ($.Repository.ComposeMetas ctx)}}</span>
1816
</span>
19-
<span class="commit-refs tw-flex tw-items-center tw-mr-1">
17+
18+
<span class="commit-refs flex-text-inline">
2019
{{range $commit.Refs}}
2120
{{$refGroup := .RefGroup}}
2221
{{if eq $refGroup "pull"}}
@@ -41,7 +40,8 @@
4140
{{end}}
4241
{{end}}
4342
</span>
44-
<span class="author tw-flex tw-items-center tw-mr-2 tw-gap-1">
43+
44+
<span class="author flex-text-inline">
4545
{{$userName := $commit.Commit.Author.Name}}
4646
{{if $commit.User}}
4747
{{if and $commit.User.FullName DefaultShowFullName}}
@@ -54,7 +54,8 @@
5454
{{$userName}}
5555
{{end}}
5656
</span>
57-
<span class="time tw-flex tw-items-center">{{DateUtils.FullTime $commit.Date}}</span>
57+
58+
<span class="time flex-text-inline">{{DateUtils.FullTime $commit.Date}}</span>
5859
{{end}}
5960
</li>
6061
{{end}}

templates/repo/latest_commit.tmpl

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<div class="latest-commit">
12
{{if not .LatestCommit}}
23
34
{{else}}
@@ -14,19 +15,21 @@
1415
<span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
1516
{{end}}
1617
{{end}}
18+
19+
<a rel="nofollow" class="ui label commit-id-short" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">{{ShortSha .LatestCommit.ID.String}}</a>
20+
21+
{{if .LatestCommitVerification}}
22+
{{template "repo/signature_badge" dict "CommitSignVerification" .LatestCommitVerification}}
23+
{{end}}
24+
25+
{{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}}
26+
1727
{{$commitLink:= printf "%s/commit/%s" .RepoLink (PathEscape .LatestCommit.ID.String)}}
18-
<span class="grey commit-summary" title="{{.LatestCommit.Summary}}">
19-
<span class="message-wrapper">{{RenderCommitMessageLinkSubject $.Context .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</span>
28+
<span class="grey commit-summary" title="{{.LatestCommit.Summary}}"><span class="message-wrapper">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .LatestCommit.Message $commitLink ($.Repository.ComposeMetas ctx)}}</span>
2029
{{if IsMultilineCommitMessage .LatestCommit.Message}}
2130
<button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button>
22-
{{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}}
23-
<pre class="commit-body tw-hidden">{{RenderCommitBody $.Context .LatestCommit.Message ($.Repository.ComposeMetas ctx)}}</pre>
24-
{{else}}
25-
{{template "repo/commit_statuses" dict "Status" .LatestCommitStatus "Statuses" .LatestCommitStatuses}}
31+
<pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .LatestCommit.Message ($.Repository.ComposeMetas ctx)}}</pre>
2632
{{end}}
2733
</span>
28-
{{if .LatestCommit.Signature}}
29-
{{template "repo/signature_badge" dict "root" $ "verification" .LatestCommitVerification "shortsha" (ShortSha .LatestCommit.ID.String)}}
30-
{{end}}
31-
<a rel="nofollow" class="commit-hash-link tw-p-2" href="{{.RepoLink}}/commit/{{PathEscape .LatestCommit.ID.String}}">{{ShortSha .LatestCommit.ID.String}}</a>
3234
{{end}}
35+
</div>

0 commit comments

Comments
 (0)