Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor "shortsha" #26877

Merged
merged 5 commits into from
Sep 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 8 additions & 18 deletions templates/repo/commits_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,18 @@
{{$class = (printf "%s%s" $class " isWarning")}}
{{end}}
{{end}}
{{$commitShaLink := ""}}
{{if $.PageIsWiki}}
<a href="{{$commitRepoLink}}/wiki/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
{{$commitShaLink = (printf "%s/wiki/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
{{else if $.PageIsPullCommits}}
<a href="{{$commitRepoLink}}/pulls/{{$.Issue.Index}}/commits/{{.ID}}" rel="nofollow" class="{{$class}}">
{{$commitShaLink = (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}}
{{else if $.Reponame}}
<a href="{{$commitRepoLink}}/commit/{{.ID}}" rel="nofollow" class="{{$class}}">
{{else}}
<span class="{{$class}}">
{{$commitShaLink = (printf "%s/commit/%s" $commitRepoLink (PathEscape .ID.String))}}
{{end}}
<a {{if $commitShaLink}}href="{{$commitShaLink}}"{{end}} class="{{$class}}">
<span class="shortsha">{{ShortSha .ID.String}}</span>
{{if .Signature}}
{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}
{{end}}
{{if $.PageIsWiki}}
</a>
{{else if $.PageIsPullCommits}}
</a>
{{else if $.Reponame}}
</a>
{{else}}
</span>
{{end}}
{{if .Signature}}{{template "repo/shabox_badge" dict "root" $ "verification" .Verification}}{{end}}
</a>
</td>
<td class="message">
<span class="message-wrapper">
Expand All @@ -78,7 +68,7 @@
{{end}}
{{template "repo/commit_statuses" dict "Status" .Status "Statuses" .Statuses "root" $}}
{{if IsMultilineCommitMessage .Message}}
<pre class="commit-body gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
<pre class="commit-body gt-m-0 gt-hidden">{{RenderCommitBody $.Context .Message $commitRepoLink $.Repository.ComposeMetas}}</pre>
{{end}}
</td>
{{if .Committer}}
Expand Down
2 changes: 1 addition & 1 deletion templates/repo/graph/commits.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<a href="{{$.RepoLink}}/commit/{{$commit.Rev|PathEscape}}" rel="nofollow" class="{{$class}}">
<span class="shortsha">{{ShortSha $commit.Commit.ID.String}}</span>
{{- if $commit.Commit.Signature -}}
<span class="shortsha-pad"></span>{{template "repo/shabox_badge" dict "root" $ "verification" $commit.Verification}}
{{template "repo/shabox_badge" dict "root" $ "verification" $commit.Verification}}
{{- end -}}
</a>
</span>
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/view_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@
<div class="ui active tiny slow centered inline">…</div>
{{else}}
{{if .LatestCommitUser}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24}}
{{ctx.AvatarUtils.Avatar .LatestCommitUser 24 "gt-mr-2"}}
{{if .LatestCommitUser.FullName}}
<a class="muted author-wrapper" title="{{.LatestCommitUser.FullName}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{.LatestCommitUser.FullName}}</strong></a>
{{else}}
<a class="muted author-wrapper" title="{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}" href="{{.LatestCommitUser.HomeLink}}"><strong>{{if .LatestCommit.Author}}{{.LatestCommit.Author.Name}}{{else}}{{.LatestCommitUser.Name}}{{end}}</strong></a>
{{end}}
{{else}}
{{if .LatestCommit.Author}}
{{ctx.AvatarUtils.AvatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24}}
{{ctx.AvatarUtils.AvatarByEmail .LatestCommit.Author.Email .LatestCommit.Author.Name 24 "gt-mr-2"}}
<span class="author-wrapper" title="{{.LatestCommit.Author.Name}}"><strong>{{.LatestCommit.Author.Name}}</strong></span>
{{end}}
{{end}}
Expand Down
6 changes: 5 additions & 1 deletion web_src/css/base.css
Original file line number Diff line number Diff line change
Expand Up @@ -1308,9 +1308,13 @@ img.ui.avatar,
.ui .sha.label {
font-family: var(--fonts-monospace);
font-size: 13px;
padding: 6px 10px 4px;
font-weight: var(--font-weight-normal);
margin: 0 6px;
padding: 5px 10px;
}

.ui .sha.label .shortsha {
display: inline-block; /* not sure whether it is still needed */
}

.ui .button.copy-commit-sha {
Expand Down
8 changes: 0 additions & 8 deletions web_src/css/features/gitgraph.css
Original file line number Diff line number Diff line change
Expand Up @@ -123,14 +123,6 @@
padding-bottom: 3px;
}

#git-graph-container #rev-list .sha.label .shortsha {
padding-top: 0;
}

#git-graph-container #rev-list .sha.label .shortsha-pad {
padding-right: 10px;
}

#git-graph-container #rev-list .sha.label .ui.detail.icon.button {
padding-top: 3px;
margin-top: -5px;
Expand Down
63 changes: 0 additions & 63 deletions web_src/css/repo.css
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,9 @@
}

.repository.file.list #repo-files-table thead th {
padding-top: 8px;
padding-bottom: 5px;
font-weight: var(--font-weight-normal);
}

.repository.file.list #repo-files-table thead .ui.avatar {
margin-bottom: 5px;
}

.repository.file.list #repo-files-table tbody .svg {
margin-left: 3px;
margin-right: 5px;
Expand Down Expand Up @@ -891,11 +885,6 @@
background: var(--color-red-badge-bg);
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isWarning .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isWarning:hover {
background: var(--color-red-badge-hover-bg) !important;
}
Expand All @@ -905,11 +894,6 @@
background: var(--color-green-badge-bg);
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerified .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerified:hover {
background: var(--color-green-badge-hover-bg) !important;
}
Expand All @@ -919,11 +903,6 @@
background: var(--color-yellow-badge-bg);
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUntrusted:hover {
background: var(--color-yellow-badge-hover-bg) !important;
}
Expand All @@ -933,11 +912,6 @@
background: var(--color-orange-badge-bg);
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository.view.issue .comment-list .timeline-item.commits-list .singular-commit .shabox .sha.label.isSigned.isVerifiedUnmatched:hover {
background: var(--color-orange-badge-hover-bg) !important;
}
Expand Down Expand Up @@ -1387,14 +1361,6 @@
background: var(--color-red-badge-bg);
}

.repository #commits-table td.sha .sha.label.isSigned.isWarning .shortsha,
.repository #repo-files-table .sha.label.isSigned.isWarning .shortsha,
.repository #rev-list .sha.label.isSigned.isWarning .shortsha,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isWarning .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository #commits-table td.sha .sha.label.isSigned.isWarning .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isWarning .detail.icon,
.repository #rev-list .sha.label.isSigned.isWarning .detail.icon,
Expand All @@ -1418,14 +1384,6 @@
background: var(--color-green-badge-bg);
}

.repository #commits-table td.sha .sha.label.isSigned.isVerified .shortsha,
.repository #repo-files-table .sha.label.isSigned.isVerified .shortsha,
.repository #rev-list .sha.label.isSigned.isVerified .shortsha,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerified .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository #commits-table td.sha .sha.label.isSigned.isVerified .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerified .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerified .detail.icon,
Expand All @@ -1449,14 +1407,6 @@
background: var(--color-yellow-badge-bg);
}

.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted .shortsha,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted .shortsha,
.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted .shortsha,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUntrusted .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerifiedUntrusted .detail.icon,
Expand All @@ -1480,14 +1430,6 @@
background: var(--color-orange-badge-bg);
}

.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched .shortsha,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched .shortsha,
.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched .shortsha,
.repository .timeline-item.commits-list .singular-commit .sha.label.isSigned.isVerifiedUnmatched .shortsha {
display: inline-block;
padding-top: 1px;
}

.repository #commits-table td.sha .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository #repo-files-table .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
.repository #rev-list .sha.label.isSigned.isVerifiedUnmatched .detail.icon,
Expand Down Expand Up @@ -2691,11 +2633,6 @@ tbody.commit-list {
line-height: initial;
}

/* commit history list */
.repository:not(.diff) .commit-body {
margin: 0;
}

/* PR-comment */
.repository:not(.diff) .timeline-item .commit-body {
margin-left: 40px;
Expand Down