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:
parent
da97544fa0
commit
994bd93e69
8 changed files with 341 additions and 25 deletions
|
@ -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}}
|
||||
|
|
|
@ -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}}
|
||||
|
||||
|
|
|
@ -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)}}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue