fixes: removed tooltip, renamed css selector for new ui and fixed the repo commit page's commit count

- annoying tooltip in mobile view
- renamed copy_hash to copy and updated the functioning $commitLink
- renamed commit-ui-redesign to commit-timeline in web_src/css/repo.css
- added condition to show total commit count in repective pages; 2 rows of commit count was displayed instead of 1, so I added an if condition to fix the issue
This commit is contained in:
iamyaash 2025-06-19 22:33:05 +05:30
commit 0e66b0105e
3 changed files with 34 additions and 36 deletions

View file

@ -1,27 +1,28 @@
<h4 class="ui top attached header commits-table tw-flex tw-items-center tw-justify-between">
<div class="commits-table-left tw-flex tw-items-center">
{{if or .PageIsCommits (gt .CommitCount 0)}}
{{ctx.Locale.TrN .CommitCount "repo.n_commit_one" "repo.n_commit_few" (ctx.Locale.PrettyNumber .CommitCount)}}
{{else if .IsNothingToCompare}}
{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}
{{else}}
{{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}}
{{end}}
</div>
{{if .IsDiffCompare}}
<div class="commits-table-right tw-whitespace-nowrap">
<a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID | PathEscape}}" class="primary sha label tw-mx-0">
<span class="shortsha">{{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}}</span>
</a>
...
<a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID | PathEscape}}" class="primary sha label tw-mx-0">
<span class="shortsha">{{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}}</span>
</a>
{{if.PageIsPullCommits}}
<h4 class="ui top attached header commits-table tw-flex tw-items-center tw-justify-between">
<div class="commits-table-left tw-flex tw-items-center">
{{if or .PageIsCommits (gt .CommitCount 0)}}
{{ctx.Locale.TrN .CommitCount "repo.n_commit_one" "repo.n_commit_few" (StringUtils.ToString .CommitCount)}}
{{else if .IsNothingToCompare}}
{{ctx.Locale.Tr "repo.commits.nothing_to_compare"}}
{{else}}
{{ctx.Locale.Tr "repo.commits.no_commits" $.BaseBranch $.HeadBranch}}
{{end}}
</div>
{{end}}
</h4>
{{if .IsDiffCompare}}
<div class="commits-table-right tw-whitespace-nowrap">
<a href="{{$.CommitRepoLink}}/commit/{{.BeforeCommitID | PathEscape}}" class="ui primary sha label tw-mx-0">
<span class="shortsha">{{if not .BaseIsCommit}}{{if .BaseIsBranch}}{{svg "octicon-git-branch"}}{{else if .BaseIsTag}}{{svg "octicon-tag"}}{{end}}{{.BaseBranch}}{{else}}{{ShortSha .BaseBranch}}{{end}}</span>
</a>
...
<a href="{{$.CommitRepoLink}}/commit/{{.AfterCommitID | PathEscape}}" class="ui primary sha label tw-mx-0">
<span class="shortsha">{{if not .HeadIsCommit}}{{if .HeadIsBranch}}{{svg "octicon-git-branch"}}{{else if .HeadIsTag}}{{svg "octicon-tag"}}{{end}}{{.HeadBranch}}{{else}}{{ShortSha .HeadBranch}}{{end}}</span>
</a>
</div>
{{end}}
</h4>
{{if .PageIsCommits}}
{{else if .PageIsCommits}}
<h4 class="ui top attached header commits-table tw-flex tw-items-center tw-justify-between">
<div class="commits-table-left tw-flex tw-items-center">
{{if or .PageIsCommits (gt .CommitCount 0)}}

View file

@ -15,7 +15,7 @@
<div class="tw-border tw-border-[--color-secondary] tw-rounded-md tw-divide-y tw-divide-[--color-secondary]">
{{end}}
<div class="commit-ui-redesign">
<div class="commit-timeline">
<div class="author">
<div class="tw-flex">
{{$userName := .Author.Name}}
@ -32,7 +32,7 @@
</div>
<div class="message">
{{$commitLink:= printf "%s/pulls/%d/commits/%s" $commitRepoLink (PathEscape .ID.String)}}
{{$commitLink := (printf "%s/pulls/%d/commits/%s" $commitRepoLink $.Issue.Index (PathEscape .ID.String))}}
<div class="message-wrapper">
{{RenderCommitMessageLinkSubject $.Context .Message $commitLink ($.Repository.ComposeMetas ctx)}}
{{if IsMultilineCommitMessage .Message}}
@ -73,14 +73,11 @@
</div>
<div class="mobile-btn">
<div class="item ui dropdown " data-tooltip-content="{{ctx.Locale.Tr "repo.more_operations"}}" aria-label="{{ctx.Locale.Tr "toggle_menu"}}">
<div class="item ui dropdown " aria-label="{{ctx.Locale.Tr "toggle_menu"}}">
{{svg "octicon-kebab-horizontal"}}
<div class="menu">
<span class="interact item" data-clipboard-text="{{.ID}}">
{{svg "octicon-copy"}} {{ctx.Locale.Tr "copy_hash"}}
<span class="{{$class}}">
{{ShortSha .ID.String}}
</span>
</span>
{{if not $.PageIsWiki}}
{{if $.FileName}}

View file

@ -2769,7 +2769,7 @@ tbody.commit-list {
/* Layout for templates/repo/pulls/commits_list.tmpl */
/* Redesigned commit layout using responsive grid configuration */
.commit-ui-redesign {
.commit-timeline {
display: grid;
background: var(--color-box-body);
padding: 0.5rem;
@ -2781,16 +2781,16 @@ tbody.commit-list {
}
@media (max-width: 640px) {
.commit-ui-redesign {
.commit-timeline {
grid-template-columns: 1fr 1fr;
}
/* manual div allocation in grid cols, since it uses a new layout for mobile */
.commit-ui-redesign .author {
.commit-timeline .author {
grid-row: 1;
grid-column: 1;
}
.commit-ui-redesign .mobile-btn {
.commit-timeline .mobile-btn {
grid-row: 1;
grid-column: 2;
justify-self: end;
@ -2798,21 +2798,21 @@ tbody.commit-list {
display: flex;
}
.commit-ui-redesign .btn { display: none;} /* manually hiding it, but we need to write this in a better way, */
.commit-timeline .btn { display: none;} /* manually hiding it, but we need to write this in a better way, */
.commit-ui-redesign .message {
.commit-timeline .message {
grid-row: 2;
grid-column: 1 / span 2;
padding-inline: 0.5rem;
}
.commit-ui-redesign .ui.sha.label {
.commit-timeline .ui.sha.label {
grid-row: 3;
grid-column: 1;
}
.commit-ui-redesign .timeline {
.commit-timeline .timeline {
grid-row: 3;
grid-column: 2;
}