1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-08-01 17:38:33 +00:00

feat(UI): add package counter to repo/user/org overview pages

- add package counter to repo/user/org overview pages
    - add go unit tests for repo/user has/count packages
    - add many more unit tests for packages model
    - fix error for non-existing packages in DeletePackageByID and SetRepositoryLink
This commit is contained in:
Robert Wolff 2024-07-31 12:40:24 +02:00
parent da97544fa0
commit 994bd93e69
8 changed files with 341 additions and 25 deletions

View file

@ -20,6 +20,10 @@
{{if and .IsPackageEnabled .CanReadPackages}}
<a class="{{if .IsPackagesPage}}active {{end}}item" href="{{$.Org.HomeLink}}/-/packages">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
{{if .PackageCount}}
<div class="ui small label">{{.PackageCount}}</div>
{{end}}
<span hidden test-name="package-count">{{.PackageCount}}</span>
</a>
{{end}}
{{if and .IsRepoIndexerEnabled .CanReadCode}}

View file

@ -135,6 +135,9 @@
{{if .Permission.CanRead $.UnitTypePackages}}
<a href="{{.RepoLink}}/packages" class="{{if .IsPackagesPage}}active {{end}}item">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
{{if .NumPackages}}
<span class="ui small label">{{CountFmt .NumPackages}}</span>
{{end}}
</a>
{{end}}

View file

@ -24,6 +24,10 @@
{{if and .IsPackageEnabled (or .ContextUser.IsIndividual .CanReadPackages)}}
<a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item">
{{svg "octicon-package"}} {{ctx.Locale.Tr "packages.title"}}
{{if .PackageCount}}
<div class="ui small label">{{.PackageCount}}</div>
{{end}}
<span hidden test-name="package-count">{{.PackageCount}}</span>
</a>
{{end}}
{{if and .IsRepoIndexerEnabled (or .ContextUser.IsIndividual .CanReadCode)}}