Fix and tweak pull request commit list (#30528)

Fixes https://github.com/go-gitea/gitea/issues/30493, regression from
https://github.com/go-gitea/gitea/pull/30374.

Also did the flexbox convertion as suggested by the existing comment.

<img width="850" alt="Screenshot 2024-04-16 at 22 28 48"
src="https://github.com/go-gitea/gitea/assets/115237/e8905944-620a-4211-b5c5-53ed3b3ee23e">

Co-authored-by: Giteabot <teabot@gitea.io>
(cherry picked from commit 311f5261cdb23b46d3f510e40fd4e2ac06e376c0)
This commit is contained in:
silverwind 2024-04-17 10:58:08 +02:00 committed by Gergely Nagy
parent 36bddba74a
commit eea7ea9d0a
No known key found for this signature in database
2 changed files with 26 additions and 27 deletions

View file

@ -6,14 +6,23 @@
<div class="singular-commit" id="{{$tag}}"> <div class="singular-commit" id="{{$tag}}">
<span class="badge badge-commit">{{svg "octicon-git-commit"}}</span> <span class="badge badge-commit">{{svg "octicon-git-commit"}}</span>
{{if .User}} {{if .User}}
<a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User}}</a> <a class="avatar" href="{{.User.HomeLink}}">{{ctx.AvatarUtils.Avatar .User 20}}</a>
{{else}} {{else}}
{{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name}} {{ctx.AvatarUtils.AvatarByEmail .Author.Email .Author.Name 20}}
{{end}} {{end}}
{{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}} {{$commitLink:= printf "%s/commit/%s" $.comment.Issue.PullRequest.BaseRepo.Link (PathEscape .ID.String)}}
<span class="shabox tw-flex tw-items-center tw-float-right"> <span class="tw-flex-1 gt-ellipsis tw-font-mono{{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.root.Context .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx)}}</span>
{{if IsMultilineCommitMessage .Message}}
<button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button>
{{end}}
{{if IsMultilineCommitMessage .Message}}
<pre class="commit-body tw-hidden">{{RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx)}}</pre>
{{end}}
<span class="shabox tw-flex tw-items-center">
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}} {{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses}}
{{$class := "ui sha label"}} {{$class := "ui sha label"}}
{{if .Signature}} {{if .Signature}}
@ -37,14 +46,6 @@
{{end}} {{end}}
</a> </a>
</span> </span>
<span class="tw-font-mono commit-summary {{if gt .ParentCount 1}} grey text{{end}}" title="{{.Summary}}">{{RenderCommitMessageLinkSubject $.root.Context .Message $commitLink ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx)}}</span>
{{if IsMultilineCommitMessage .Message}}
<button class="ui button js-toggle-commit-body ellipsis-button" aria-expanded="false">...</button>
{{end}}
{{if IsMultilineCommitMessage .Message}}
<pre class="commit-body tw-hidden">{{RenderCommitBody $.root.Context .Message ($.comment.Issue.PullRequest.BaseRepo.ComposeMetas ctx)}}</pre>
{{end}}
</div> </div>
{{end}} {{end}}
</div> </div>

View file

@ -836,55 +836,53 @@ td .commit-summary {
margin-right: 0.25em; margin-right: 0.25em;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit { .singular-commit {
line-height: 34px; /* this must be same as .badge height, to avoid overflow */ display: flex;
clear: both; /* reset the "float right shabox", in the future, use flexbox instead */ align-items: center;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit > img.avatar, .singular-commit .badge {
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit > .avatar img { height: 30px !important;
position: relative;
top: -2px;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label { .singular-commit .shabox .sha.label {
margin: 0; margin: 0;
border: 1px solid var(--color-light-border); border: 1px solid var(--color-light-border);
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isWarning { .singular-commit .shabox .sha.label.isSigned.isWarning {
border: 1px solid var(--color-red-badge); border: 1px solid var(--color-red-badge);
background: var(--color-red-badge-bg); background: var(--color-red-badge-bg);
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isWarning:hover { .singular-commit .shabox .sha.label.isSigned.isWarning:hover {
background: var(--color-red-badge-hover-bg) !important; background: var(--color-red-badge-hover-bg) !important;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerified { .singular-commit .shabox .sha.label.isSigned.isVerified {
border: 1px solid var(--color-green-badge); border: 1px solid var(--color-green-badge);
background: var(--color-green-badge-bg); background: var(--color-green-badge-bg);
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerified:hover { .singular-commit .shabox .sha.label.isSigned.isVerified:hover {
background: var(--color-green-badge-hover-bg) !important; background: var(--color-green-badge-hover-bg) !important;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted { .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted {
border: 1px solid var(--color-yellow-badge); border: 1px solid var(--color-yellow-badge);
background: var(--color-yellow-badge-bg); background: var(--color-yellow-badge-bg);
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted:hover { .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted:hover {
background: var(--color-yellow-badge-hover-bg) !important; background: var(--color-yellow-badge-hover-bg) !important;
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched { .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched {
border: 1px solid var(--color-orange-badge); border: 1px solid var(--color-orange-badge);
background: var(--color-orange-badge-bg); background: var(--color-orange-badge-bg);
} }
.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched:hover { .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched:hover {
background: var(--color-orange-badge-hover-bg) !important; background: var(--color-orange-badge-hover-bg) !important;
} }