Show hint to link package to repo when viewing empty repo package list (#20504)
* show hint to link package to repo on empty repo package listing * reword
This commit is contained in:
parent
158f2746b8
commit
2ae1675092
|
@ -3044,6 +3044,7 @@ title = Packages
|
||||||
desc = Manage repository packages.
|
desc = Manage repository packages.
|
||||||
empty = There are no packages yet.
|
empty = There are no packages yet.
|
||||||
empty.documentation = For more information on the package registry, see <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/overview">the documentation</a>.
|
empty.documentation = For more information on the package registry, see <a target="_blank" rel="noopener noreferrer" href="https://docs.gitea.io/en-us/packages/overview">the documentation</a>.
|
||||||
|
empty.repo = Did you upload a package, but it's not shown here? Go to <a href="%[1]s">package settings</a> and link it to this repo.
|
||||||
filter.type = Type
|
filter.type = Type
|
||||||
filter.type.all = All
|
filter.type.all = All
|
||||||
filter.no_result = Your filter produced no results.
|
filter.no_result = Your filter produced no results.
|
||||||
|
|
|
@ -9,6 +9,7 @@ import (
|
||||||
|
|
||||||
"code.gitea.io/gitea/models/db"
|
"code.gitea.io/gitea/models/db"
|
||||||
"code.gitea.io/gitea/models/packages"
|
"code.gitea.io/gitea/models/packages"
|
||||||
|
"code.gitea.io/gitea/models/unit"
|
||||||
"code.gitea.io/gitea/modules/base"
|
"code.gitea.io/gitea/modules/base"
|
||||||
"code.gitea.io/gitea/modules/context"
|
"code.gitea.io/gitea/modules/context"
|
||||||
"code.gitea.io/gitea/modules/setting"
|
"code.gitea.io/gitea/modules/setting"
|
||||||
|
@ -62,6 +63,9 @@ func Packages(ctx *context.Context) {
|
||||||
ctx.Data["Query"] = query
|
ctx.Data["Query"] = query
|
||||||
ctx.Data["PackageType"] = packageType
|
ctx.Data["PackageType"] = packageType
|
||||||
ctx.Data["HasPackages"] = hasPackages
|
ctx.Data["HasPackages"] = hasPackages
|
||||||
|
if ctx.Repo != nil {
|
||||||
|
ctx.Data["CanWritePackages"] = ctx.IsUserRepoWriter([]unit.Type{unit.TypePackages}) || ctx.IsUserSiteAdmin()
|
||||||
|
}
|
||||||
ctx.Data["PackageDescriptors"] = pds
|
ctx.Data["PackageDescriptors"] = pds
|
||||||
ctx.Data["Total"] = total
|
ctx.Data["Total"] = total
|
||||||
ctx.Data["RepositoryAccessMap"] = map[int64]bool{ctx.Repo.Repository.ID: true} // There is only the current repository
|
ctx.Data["RepositoryAccessMap"] = map[int64]bool{ctx.Repo.Repository.ID: true} // There is only the current repository
|
||||||
|
|
|
@ -47,6 +47,10 @@
|
||||||
<div class="empty center">
|
<div class="empty center">
|
||||||
{{svg "octicon-package" 32}}
|
{{svg "octicon-package" 32}}
|
||||||
<h2>{{.locale.Tr "packages.empty"}}</h2>
|
<h2>{{.locale.Tr "packages.empty"}}</h2>
|
||||||
|
{{if and .Repository .CanWritePackages}}
|
||||||
|
{{$packagesUrl := URLJoin .Owner.HTMLURL "-" "packages" }}
|
||||||
|
<p>{{.locale.Tr "packages.empty.repo" $packagesUrl | Safe}}</p>
|
||||||
|
{{end}}
|
||||||
<p>{{.locale.Tr "packages.empty.documentation" | Safe}}</p>
|
<p>{{.locale.Tr "packages.empty.documentation" | Safe}}</p>
|
||||||
</div>
|
</div>
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
Loading…
Reference in New Issue