Skip to content

Commit 04eea29

Browse files
GiteaBotlunny
andauthored
Fix tags header and pretty format numbers (go-gitea#25624) (go-gitea#25694)
Backport go-gitea#25624 by @lunny This casused by go-gitea#23465 Before release disabled <img width="1320" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/190a1c81-daa5-41bc-91ac-c9a0bf629b5f"> release enabled <img width="1320" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/a0372c31-727c-4ee0-a6b9-30e502498d90"> After release disabled <img width="1304" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/a747ea80-a3d9-4792-8f6d-e8955da78b9e"> release enabled <img width="1290" alt="图片" src="https://github.com/go-gitea/gitea/assets/81045/7c0bc43a-9149-4148-859d-35839aeb60ca"> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 511be9f commit 04eea29

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

routers/web/repo/release.go

+1
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
203203
ctx.Data["Page"] = pager
204204

205205
if isTagList {
206+
ctx.Data["PageIsViewCode"] = !ctx.Repo.Repository.UnitEnabled(ctx, unit.TypeReleases)
206207
ctx.HTML(http.StatusOK, tplTagsList)
207208
} else {
208209
ctx.HTML(http.StatusOK, tplReleasesList)

templates/repo/header.tmpl

+1-1
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@
207207
{{end}}
208208

209209
{{if and (.Permission.CanRead $.UnitTypeReleases) (not .IsEmptyRepo)}}
210-
<a class="{{if .PageIsReleaseList}}active {{end}}item" href="{{.RepoLink}}/releases">
210+
<a class="{{if or .PageIsReleaseList .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/releases">
211211
{{svg "octicon-tag"}} {{.locale.Tr "repo.releases"}}
212212
{{if .NumReleases}}
213213
<span class="ui small label">{{CountFmt .NumReleases}}</span>

templates/repo/release_tag_header.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
<div class="gt-df">
66
<div class="gt-f1 gt-df gt-ac">
77
<h2 class="ui compact small menu header small-menu-items">
8-
<a class="{{if .PageIsReleaseList}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.Tr "repo.release.releases"}}</a>
8+
<a class="{{if .PageIsReleaseList}}active {{end}}item" href="{{.RepoLink}}/releases">{{.locale.PrettyNumber .ReleasesNum}} {{.locale.TrN .ReleasesNum "repo.release" "repo.releases"}}</a>
99
{{if $canReadCode}}
10-
<a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a>
10+
<a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.PrettyNumber .NumTags}} {{.locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
1111
{{end}}
1212
</h2>
1313
{{if .EnableFeed}}

templates/repo/sub_menu.tmpl

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77
<a href="{{.RepoLink}}/commits/{{.BranchNameSubURL}}">{{svg "octicon-history"}} <b>{{.locale.PrettyNumber .CommitsCount}}</b> {{.locale.TrN .CommitsCount "repo.commit" "repo.commits"}}</a>
88
</div>
99
<div class="item{{if .PageIsBranches}} active{{end}}">
10-
<a href="{{.RepoLink}}/branches">{{svg "octicon-git-branch"}} <b>{{.BranchesCount}}</b> {{.locale.TrN .BranchesCount "repo.branch" "repo.branches"}}</a>
10+
<a href="{{.RepoLink}}/branches">{{svg "octicon-git-branch"}} <b>{{.locale.PrettyNumber .BranchesCount}}</b> {{.locale.TrN .BranchesCount "repo.branch" "repo.branches"}}</a>
1111
</div>
1212
{{if $.Permission.CanRead $.UnitTypeCode}}
1313
<div class="item{{if .PageIsTagList}} active{{end}}">
14-
<a href="{{.RepoLink}}/tags">{{svg "octicon-tag"}} <b>{{.NumTags}}</b> {{.locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
14+
<a href="{{.RepoLink}}/tags">{{svg "octicon-tag"}} <b>{{.locale.PrettyNumber .NumTags}}</b> {{.locale.TrN .NumTags "repo.tag" "repo.tags"}}</a>
1515
</div>
1616
{{end}}
1717
<div class="item">

0 commit comments

Comments
 (0)