Skip to content

Commit aae3308

Browse files
committed
temp
1 parent 2071013 commit aae3308

File tree

8 files changed

+210
-493
lines changed

8 files changed

+210
-493
lines changed

templates/repo/commit_page.tmpl

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,14 +55,17 @@
5555
</div>
5656
<div class="content">
5757
<p id="cherry-pick-content" class="branch-dropdown"></p>
58-
{{template "repo/branch_dropdown" dict "root" .
59-
"noTag" true "disableCreateBranch" true
60-
"branchForm" "branch-dropdown-form"
61-
"branchURLPrefix" (printf "%s/_cherrypick/%s/" $.RepoLink .CommitID) "branchURLSuffix" ""
62-
"setAction" true "submitForm" true}}
63-
<form method="get" action="{{$.RepoLink}}/_cherrypick/{{.CommitID}}/{{if $.BranchName}}{{PathEscapeSegments $.BranchName}}{{else}}{{PathEscapeSegments $.Repository.DefaultBranch}}{{end}}" id="branch-dropdown-form">
64-
<input type="hidden" name="ref" value="{{if $.BranchName}}{{$.BranchName}}{{else}}{{$.Repository.DefaultBranch}}{{end}}">
65-
<input type="hidden" name="refType" value="branch">
58+
59+
<form method="get">
60+
{{/*FIXME: CurrentRefShortName seems not making sense here (old code),
61+
because the "commit page" has no "$.BranchName" info, so only using DefaultBranch should be enough */}}
62+
{{template "repo/branch_dropdown" dict
63+
"Repository" .Repository
64+
"ShowTabBranches" true
65+
"CurrentRefType" "branch"
66+
"CurrentRefShortName" (or $.BranchName $.Repository.DefaultBranch)
67+
"RefFormActionTemplate" (print "{RepoLink}/_cherrypick/" .CommitID "/{RefShortName}")
68+
}}
6669
<input type="hidden" id="cherry-pick-type" name="cherry-pick-type"><br>
6770
<button type="submit" id="cherry-pick-submit" class="ui primary button"></button>
6871
</form>
@@ -124,7 +127,7 @@
124127
{{end}}
125128
</div>
126129
{{if IsMultilineCommitMessage .Commit.Message}}
127-
<pre class="commit-body">{{RenderCommitBody $.Context .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre>
130+
<pre class="commit-body">{{ctx.RenderUtils.RenderCommitBody .Commit.Message ($.Repository.ComposeMetas ctx)}}</pre>
128131
{{end}}
129132
{{template "repo/commit_load_branches_and_tags" .}}
130133
</div>
@@ -141,7 +144,7 @@
141144
{{ctx.AvatarUtils.AvatarByEmail .Commit.Author.Email .Commit.Author.Email 20}}
142145
<strong>{{.Commit.Author.Name}}</strong>
143146
{{end}}
144-
<span class="text grey" id="authored-time">{{TimeSince .Commit.Author.When ctx.Locale}}</span>
147+
<span class="text grey tw-ml-2" id="authored-time">{{DateUtils.TimeSince .Commit.Author.When}}</span>
145148
{{if or (ne .Commit.Committer.Name .Commit.Author.Name) (ne .Commit.Committer.Email .Commit.Author.Email)}}
146149
<span class="text grey">{{ctx.Locale.Tr "repo.diff.committed_by"}}</span>
147150
{{if ne .Verification.CommittingUser.ID 0}}
@@ -173,7 +176,7 @@
173176
</div>
174177
{{if .NoteRendered}}
175178
<div class="ui top attached header segment git-notes">
176-
{{svg "octicon-note" 16}}
179+
{{svg "octicon-note" 16 "tw-mr-2"}}
177180
{{ctx.Locale.Tr "repo.diff.git-notes"}}:
178181
{{if .NoteAuthor}}
179182
<a href="{{.NoteAuthor.HomeLink}}">
@@ -186,7 +189,7 @@
186189
{{else}}
187190
<strong>{{.NoteCommit.Author.Name}}</strong>
188191
{{end}}
189-
<span class="text grey" id="note-authored-time">{{TimeSince .NoteCommit.Author.When ctx.Locale}}</span>
192+
<span class="text grey" id="note-authored-time">{{DateUtils.TimeSince .NoteCommit.Author.When}}</span>
190193
</div>
191194
<div class="ui bottom attached info segment git-notes">
192195
<pre class="commit-body">{{.NoteRendered | SanitizeHTML}}</pre>

templates/repo/commits_list.tmpl

Lines changed: 82 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -1,71 +1,99 @@
1+
<!-- FIXME -->
12
<div class="ui attached table segment commit-table">
2-
<div class="ui very basic striped table unstackable" id="commits-table">
3-
<ul class="commit-list tw-list-none tw-divide-y tw-divide-secondary tw-p-0 tw-m-0">
3+
<table class="ui very basic striped table unstackable" id="commits-table">
4+
<thead>
5+
<tr>
6+
<th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th>
7+
<th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th>
8+
<th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
9+
<th class="two wide right aligned">{{ctx.Locale.Tr "repo.commits.date"}}</th>
10+
<th class="one wide"></th>
11+
</tr>
12+
</thead>
13+
<tbody class="commit-list">
414
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
515
{{range .Commits}}
6-
<li class="tw-grid tw-gap-1 tw-px-4 tw-py-2 tw-items-center tw-grid-cols-[minmax(30%,1fr)_minmax(0px,max-content)]">
7-
<div class="message">
16+
<tr>
17+
<td class="author">
18+
<div class="tw-flex">
19+
{{$userName := .Author.Name}}
20+
{{if .User}}
21+
{{if and .User.FullName DefaultShowFullName}}
22+
{{$userName = .User.FullName}}
23+
{{end}}
24+
{{ctx.AvatarUtils.Avatar .User 28 "tw-mr-2"}}<a class="muted author-wrapper" href="{{.User.HomeLink}}">{{$userName}}</a>
25+
{{else}}
26+
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 28 "tw-mr-2"}}
27+
<span class="author-wrapper">{{$userName}}</span>
28+
{{end}}
29+
</div>
30+
</td>
31+
<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}}
47+
{{$commitShaLink := ""}}
48+
{{if $.PageIsWiki}}
49+
{{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
50+
{{else if $.PageIsPullCommits}}
51+
{{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}}
52+
{{else if $.Reponame}}
53+
{{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
54+
{{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>
59+
</td>
60+
<td class="message">
861
<span class="message-wrapper">
962
{{if $.PageIsWiki}}
10-
<span class="commit-summary{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | RenderEmoji $.Context}}</span>
63+
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | ctx.RenderUtils.RenderEmoji}}</span>
1164
{{else}}
1265
{{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
13-
<span class="commit-summary{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.Context .Message $commitLink ($.Repository.ComposeMetas ctx)}}</span>
66+
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.Repository.ComposeMetas ctx)}}</span>
1467
{{end}}
1568
</span>
1669
{{if IsMultilineCommitMessage .Message}}
17-
<button class="ui button js-toggle-commit-body ellipsis-button tw-ml-1" aria-expanded="false">...</button>
70+
<button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button>
1871
{{end}}
72+
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
1973
{{if IsMultilineCommitMessage .Message}}
20-
<pre class="commit-body tw-hidden tw-text-xs tw-mt-2">{{RenderCommitBody $.Context .Message ($.Repository.ComposeMetas ctx)}}</pre>
74+
<pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message ($.Repository.ComposeMetas ctx)}}</pre>
2175
{{end}}
22-
</div>
23-
<div class="author tw-row-start-2 tw-text-text-light-2">
24-
<div class="tw-flex tw-items-center tw-gap-1">
25-
{{$userName := .Author.Name}}
26-
{{if .User}}
27-
{{if and .User.FullName DefaultShowFullName}}
28-
{{$userName = .User.FullName}}
29-
{{end}}
30-
{{ctx.AvatarUtils.Avatar .User 20}}<a class="muted author-wrapper tw-max-w-full" href="{{.User.HomeLink}}">{{$userName}},</a>
31-
{{else}}
32-
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20}}
33-
<span class="author-wrapper tw-max-w-full">{{$userName}},</span>
34-
{{end}}
35-
{{if .Committer}}
36-
<div class="text right aligned">{{TimeSince .Committer.When ctx.Locale}}</div>
37-
{{else}}
38-
<td class="text right aligned">{{TimeSince .Author.When ctx.Locale}}</td>
76+
{{if $.CommitsTagsMap}}
77+
{{range (index $.CommitsTagsMap .ID.String)}}
78+
{{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}}
3979
{{end}}
40-
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
41-
</div>
42-
</div>
43-
<div class="tw-col-start-2 tw-row-span-2 tw-flex tw-gap-2 tw-items-center tw-justify-end">
44-
{{if .Signature}}
45-
{{template "repo/signature_badge" dict "root" $ "verification" .Verification "shortsha" (ShortSha .ID.String)}}
4680
{{end}}
47-
<div>
48-
{{$commitShaLink := ""}}
49-
{{if $.PageIsWiki}}
50-
{{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
51-
{{else if $.PageIsPullCommits}}
52-
{{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}}
53-
{{else if $.Reponame}}
54-
{{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
55-
{{end}}
56-
<a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="commit-hash-link tw-p-2 hover:tw-bg-hover hover:tw-no-underline tw-rounded-lg">{{ShortSha .ID.String}}</a>
57-
</div>
58-
<div class="text right aligned tw-py-0">
59-
<button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
60-
{{if not $.PageIsWiki}}{{/* at the moment, wiki doesn't support "view at history point*/}}
61-
{{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
62-
{{if $.FileName}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileName)}}{{end}}
63-
<a class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a>
64-
{{end}}
65-
</div>
66-
</div>
67-
</li>
81+
</td>
82+
{{if .Committer}}
83+
<td class="text right aligned">{{DateUtils.TimeSince .Committer.When}}</td>
84+
{{else}}
85+
<td class="text right aligned">{{DateUtils.TimeSince .Author.When}}</td>
86+
{{end}}
87+
<td class="text right aligned tw-py-0">
88+
<button class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
89+
{{if not $.PageIsWiki}}{{/* at the moment, wiki doesn't support "view at history point*/}}
90+
{{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
91+
{{if $.FileName}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileName)}}{{end}}
92+
<a class="btn interact-bg tw-p-2" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a>
93+
{{end}}
94+
</td>
95+
</tr>
6896
{{end}}
69-
</ul>
70-
</div>
97+
</tbody>
98+
</table>
7199
</div>

templates/repo/commits_list_small.tmpl

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,13 @@
1313

1414
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
1515

16-
<div class="tw-flex-1">
17-
<span class="tw-font-mono gt-ellipsis" title="{{.Summary}}">
18-
{{- RenderCommitMessageLinkSubject $.root.Context .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}}
19-
</span>
16+
<span class="tw-flex-1 tw-font-mono gt-ellipsis" title="{{.Summary}}">
17+
{{- ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}}
18+
</span>
2019

21-
{{if IsMultilineCommitMessage .Message}}
22-
<button class="ui button ellipsis-button show-panel toggle tw-ml-1" data-panel="[data-singular-commit-body-for='{{$tag}}']">...</button>
23-
{{end}}
24-
</div>
20+
{{if IsMultilineCommitMessage .Message}}
21+
<button class="ui button ellipsis-button show-panel toggle" data-panel="[data-singular-commit-body-for='{{$tag}}']">...</button>
22+
{{end}}
2523

2624
<span class="tw-flex tw-items-center tw-gap-2">
2725
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
@@ -33,7 +31,7 @@
3331
</div>
3432
{{if IsMultilineCommitMessage .Message}}
3533
<pre class="commit-body tw-ml-[33px] tw-hidden" data-singular-commit-body-for="{{$tag}}">
36-
{{- RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}}
34+
{{- ctx.RenderUtils.RenderCommitBody .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx) -}}
3735
</pre>
3836
{{end}}
3937
{{end}}

templates/repo/graph/commits.tmpl

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<div id="rev-container">
22
<ul id="rev-list">
33
{{range $commitI, $commit := .Graph.Commits}}
4-
<li {{if $commit.Rev}}id="commit-{{$commit.Rev}}"{{end}} class="tw-flex tw-gap-2" data-flow="{{$commit.Flow}}">
4+
<li {{if $commit.Rev}}id="commit-{{$commit.Rev}}"{{end}} data-flow="{{$commit.Flow}}">
55
{{if $commit.OnlyRelation}}
66
<span></span>
77
{{else}}
@@ -13,23 +13,21 @@
1313
{{template "repo/signature_badge" dict "root" $ "verification" $commit.Verification "shortsha" (ShortSha $commit.Commit.ID.String)}}
1414
</span>
1515
{{- end -}}
16-
<span class="tw-inline-block gt-ellipsis">
17-
<span>{{RenderCommitMessage $.Context $commit.Subject ($.Repository.ComposeMetas ctx)}}</span>
16+
<span class="message tw-inline-block gt-ellipsis tw-mr-2">
17+
<span>{{ctx.RenderUtils.RenderCommitMessage $commit.Subject ($.Repository.ComposeMetas ctx)}}</span>
1818
</span>
19-
<span class="commit-refs tw-flex tw-items-center">
19+
<span class="commit-refs tw-flex tw-items-center tw-mr-1">
2020
{{range $commit.Refs}}
2121
{{$refGroup := .RefGroup}}
2222
{{if eq $refGroup "pull"}}
2323
{{if or (not $.HidePRRefs) (SliceUtils.Contains $.SelectedBranches .Name)}}
2424
<!-- it's intended to use issues not pulls, if it's a pull you will get redirected -->
25-
<a class="ui labelled basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled $.Context ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
25+
<a class="ui labelled basic tiny button" href="{{$.RepoLink}}/{{if $.Repository.UnitEnabled ctx ctx.Consts.RepoUnitTypePullRequests}}pulls{{else}}issues{{end}}/{{.ShortName|PathEscape}}">
2626
{{svg "octicon-git-pull-request"}} #{{.ShortName}}
2727
</a>
2828
{{end}}
2929
{{else if eq $refGroup "tags"}}
30-
<a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/tag/{{.ShortName|PathEscape}}">
31-
{{svg "octicon-tag"}} {{.ShortName}}
32-
</a>
30+
{{- template "repo/tag/name" dict "RepoLink" $.Repository.Link "TagName" .ShortName -}}
3331
{{else if eq $refGroup "remotes"}}
3432
<a class="ui labelled basic tiny button" href="{{$.RepoLink}}/src/commit/{{$commit.Rev|PathEscape}}">
3533
{{svg "octicon-cross-reference"}} {{.ShortName}}
@@ -43,20 +41,20 @@
4341
{{end}}
4442
{{end}}
4543
</span>
46-
<span class="author tw-flex tw-items-center">
44+
<span class="author tw-flex tw-items-center tw-mr-2 tw-gap-1">
4745
{{$userName := $commit.Commit.Author.Name}}
4846
{{if $commit.User}}
4947
{{if and $commit.User.FullName DefaultShowFullName}}
5048
{{$userName = $commit.User.FullName}}
5149
{{end}}
52-
<span class="tw-mr-1">{{ctx.AvatarUtils.Avatar $commit.User}}</span>
50+
{{ctx.AvatarUtils.Avatar $commit.User 18}}
5351
<a href="{{$commit.User.HomeLink}}">{{$userName}}</a>
5452
{{else}}
55-
<span class="tw-mr-1">{{ctx.AvatarUtils.AvatarByEmail $commit.Commit.Author.Email $userName}}</span>
53+
{{ctx.AvatarUtils.AvatarByEmail $commit.Commit.Author.Email $userName 18}}
5654
{{$userName}}
5755
{{end}}
5856
</span>
59-
<span class="time tw-flex tw-items-center">{{DateTime "full" $commit.Date}}</span>
57+
<span class="time tw-flex tw-items-center">{{DateUtils.FullTime $commit.Date}}</span>
6058
{{end}}
6159
</li>
6260
{{end}}

templates/repo/latest_commit.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{{if not .LatestCommit}}
2-
<div class="ui active tiny slow centered inline">…</div>
2+
33
{{else}}
44
{{if .LatestCommitUser}}
5-
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24}}
5+
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24 "tw-mr-1"}}
66
{{if and .LatestCommitUser.FullName DefaultShowFullName}}
77
<a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
88
{{else}}

web_src/css/base.css

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
--height-loading: 16rem;
2424
--min-height-textarea: 132px; /* padding + 6 lines + border = calc(1.57142em + 6lh + 2px), but lh is not fully supported */
2525
--tab-size: 4;
26-
--font-size-mono: 0.95em; /* compensate for monospace fonts being usually slightly larger */
2726
--checkbox-size: 15px; /* height and width of checkbox and radio inputs */
2827
--page-spacing: 16px; /* space between page elements */
2928
--page-margin-x: 32px; /* minimum space on left and right side of page */
@@ -86,7 +85,7 @@ code,
8685
kbd,
8786
samp,
8887
.tw-font-mono {
89-
font-size: var(--font-size-mono);
88+
font-size: 0.95em; /* compensate for monospace fonts being usually slightly larger */
9089
}
9190

9291
b,
@@ -752,16 +751,6 @@ input:-webkit-autofill:active,
752751
display: inline-block; /* not sure whether it is still needed */
753752
}
754753

755-
.commit-hash-link {
756-
color: inherit;
757-
font-family: var(--fonts-monospace);
758-
font-size: var(--font-size-mono);
759-
}
760-
761-
.commit-hash-link:hover {
762-
color: inherit;
763-
}
764-
765754
.ui .button.truncate {
766755
display: inline-block;
767756
max-width: 100%;
@@ -1292,7 +1281,6 @@ table th[data-sortt-desc] .svg {
12921281
font-weight: var(--font-weight-semibold) !important;
12931282
line-height: 6px !important;
12941283
vertical-align: middle !important;
1295-
flex-shrink: 0;
12961284
}
12971285

12981286
.truncated-item-name {

0 commit comments

Comments
 (0)