Files

87 lines
4.1 KiB
Handlebars
Raw Permalink Normal View History

2022-05-16 16:45:12 +00:00
<div class="ui attached table segment commit-table">
2026-02-11 02:58:56 +01:00
<table class="ui very basic table unstackable" id="commits-table">
2024-04-06 02:03:07 +08:00
<thead>
<tr>
<th class="three wide">{{ctx.Locale.Tr "repo.commits.author"}}</th>
<th class="two wide sha">{{StringUtils.ToUpper $.Repository.ObjectFormatName}}</th>
<th class="eight wide message">{{ctx.Locale.Tr "repo.commits.message"}}</th>
<th class="two wide tw-text-right">{{ctx.Locale.Tr "repo.commits.date"}}</th>
2024-04-06 02:03:07 +08:00
<th class="one wide"></th>
</tr>
</thead>
<tbody class="commit-list">
{{$commitRepoLink := $.RepoLink}}{{if $.CommitRepoLink}}{{$commitRepoLink = $.CommitRepoLink}}{{end}}
{{range .Commits}}
<tr>
<td class="author">
<span class="author-wrapper">
{{- if .User -}}
{{- ctx.AvatarUtils.Avatar .User 20 "tw-mr-2" -}}
{{- .User.GetShortDisplayNameLinkHTML -}}
{{- else -}}
{{- ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20 "tw-mr-2" -}}
{{- .Author.Name -}}
{{- end -}}
</span>
2024-04-06 02:03:07 +08:00
</td>
<td class="sha">
2024-12-27 21:18:30 +01:00
{{$commitBaseLink := ""}}
2024-04-06 02:03:07 +08:00
{{if $.PageIsWiki}}
2024-12-27 21:18:30 +01:00
{{$commitBaseLink = printf "%s/wiki/commit" $commitRepoLink}}
2024-04-06 02:03:07 +08:00
{{else if $.PageIsPullCommits}}
2024-12-27 21:18:30 +01:00
{{$commitBaseLink = printf "%s/pulls/%d/commits" $commitRepoLink $.Issue.Index}}
2024-04-06 02:03:07 +08:00
{{else if $.Reponame}}
2024-12-27 21:18:30 +01:00
{{$commitBaseLink = printf "%s/commit" $commitRepoLink}}
2024-04-06 02:03:07 +08:00
{{end}}
2024-12-27 21:18:30 +01:00
{{template "repo/commit_sign_badge" dict "Commit" . "CommitBaseLink" $commitBaseLink "CommitSignVerification" .Verification}}
2024-04-06 02:03:07 +08:00
</td>
<td class="message">
<span class="message-wrapper">
{{if $.PageIsWiki}}
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{.Summary | ctx.RenderUtils.RenderEmoji}}</span>
2022-01-24 22:11:40 +00:00
{{else}}
2024-04-06 02:03:07 +08:00
{{$commitLink:= printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
<span class="commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{ctx.RenderUtils.RenderCommitMessageLinkSubject .Message $commitLink $.Repository}}</span>
2024-04-06 02:03:07 +08:00
{{end}}
</span>
{{if IsMultilineCommitMessage .Message}}
<button class="ui button ellipsis-button" aria-expanded="false" data-global-click="onRepoEllipsisButtonClick">...</button>
2022-01-24 22:11:40 +00:00
{{end}}
2024-04-06 02:03:07 +08:00
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
{{if IsMultilineCommitMessage .Message}}
<pre class="commit-body tw-hidden">{{ctx.RenderUtils.RenderCommitBody .Message $.Repository}}</pre>
2024-04-06 02:03:07 +08:00
{{end}}
2024-08-20 01:04:06 +08:00
{{if $.CommitsTagsMap}}
{{range (index $.CommitsTagsMap .ID.String)}}
2025-07-04 23:41:19 +08:00
{{- template "repo/tag/name" dict "AdditionalClasses" "tw-py-0" "RepoLink" $.Repository.Link "TagName" .TagName "IsRelease" (not .IsTag) -}}
2024-08-20 01:04:06 +08:00
{{end}}
{{end}}
2024-04-06 02:03:07 +08:00
</td>
{{if .Committer}}
<td class="tw-text-right">{{DateUtils.TimeSince .Committer.When}}</td>
2024-04-06 02:03:07 +08:00
{{else}}
<td class="tw-text-right">{{DateUtils.TimeSince .Author.When}}</td>
2024-04-06 02:03:07 +08:00
{{end}}
<td class="tw-text-right tw-py-0">
2025-03-14 15:45:11 +08:00
<button class="btn interact-bg tw-p-2 copy-commit-id" data-tooltip-content="{{ctx.Locale.Tr "copy_hash"}}" data-clipboard-text="{{.ID}}">{{svg "octicon-copy"}}</button>
{{/* at the moment, wiki doesn't support these "view" links like "view at history point" */}}
{{if not $.PageIsWiki}}
{{/* view single file diff */}}
2025-04-14 03:27:31 +08:00
{{if $.FileTreePath}}
2025-03-14 15:45:11 +08:00
<a class="btn interact-bg tw-p-2 view-single-diff" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_file_diff"}}"
2025-04-14 03:27:31 +08:00
href="{{$commitRepoLink}}/commit/{{.ID.String}}?files={{$.FileTreePath}}"
2025-03-14 15:45:11 +08:00
>{{svg "octicon-file-diff"}}</a>
{{end}}
{{/* view at history point */}}
2024-04-06 02:03:07 +08:00
{{$viewCommitLink := printf "%s/src/commit/%s" $commitRepoLink (PathEscape .ID.String)}}
2025-04-14 03:27:31 +08:00
{{if $.FileTreePath}}{{$viewCommitLink = printf "%s/%s" $viewCommitLink (PathEscapeSegments $.FileTreePath)}}{{end}}
2025-03-14 15:45:11 +08:00
<a class="btn interact-bg tw-p-2 view-commit-path" data-tooltip-content="{{ctx.Locale.Tr "repo.commits.view_path"}}" href="{{$viewCommitLink}}">{{svg "octicon-file-code"}}</a>
2024-04-06 02:03:07 +08:00
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
</div>