diff options
author | Giteabot <teabot@gitea.io> | 2023-03-10 11:08:28 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-10 10:08:28 -0600 |
commit | e259daeff85f70ab1744efbbf28fcfcd21e2ac3b (patch) | |
tree | 1deecf5d03da79a80e6b30bd94f15241cde55d57 /templates | |
parent | edb618c136acfba84b34b9afc12245c078323d2b (diff) | |
download | gitea-e259daeff85f70ab1744efbbf28fcfcd21e2ac3b.tar.gz gitea-e259daeff85f70ab1744efbbf28fcfcd21e2ac3b.zip |
Add missing tabs to org projects page (#22705) (#23412)
Backport #22705 by @yp05327
Fixes https://github.com/go-gitea/gitea/issues/22676
Context Data `IsOrganizationMember` and `IsOrganizationOwner` is used to
control the visibility of `people` and `team` tab.
https://github.com/go-gitea/gitea/blob/2871ea08096cba15546f357d0ec473734ee9d8be/templates/org/menu.tmpl#L19-L40
And because of the reuse of user projects page, User Context is changed
to Organization Context. But the value of `IsOrganizationMember` and
`IsOrganizationOwner` are not being given.
I reused func `HandleOrgAssignment` to add them to the ctx, but may have
some unnecessary variables, idk whether it is ok.
I found there is a missing `PageIsViewProjects` at create project page.
Co-authored-by: yp05327 <576951401@qq.com>
Diffstat (limited to 'templates')
-rw-r--r-- | templates/org/menu.tmpl | 8 | ||||
-rw-r--r-- | templates/user/overview/header.tmpl | 6 |
2 files changed, 9 insertions, 5 deletions
diff --git a/templates/org/menu.tmpl b/templates/org/menu.tmpl index 25f459c09c..2a359d8111 100644 --- a/templates/org/menu.tmpl +++ b/templates/org/menu.tmpl @@ -3,16 +3,18 @@ <a class="{{if .PageIsViewRepositories}}active {{end}}item" href="{{$.Org.HomeLink}}"> {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} </a> + {{if and .IsProjectEnabled .CanReadProjects}} <a class="{{if .PageIsViewProjects}}active {{end}}item" href="{{$.Org.HomeLink}}/-/projects"> {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} </a> - {{if .IsPackageEnabled}} + {{end}} + {{if and .IsPackageEnabled .CanReadPackages}} <a class="item" href="{{$.Org.HomeLink}}/-/packages"> {{svg "octicon-package"}} {{.locale.Tr "packages.title"}} </a> {{end}} - {{if .IsRepoIndexerEnabled}} - <a class="{{if $.PageIsOrgCode}}active {{end}}item" href="{{$.Org.HomeLink}}/-/code"> + {{if and .IsRepoIndexerEnabled .CanReadCode}} + <a class="item" href="{{$.Org.HomeLink}}/-/code"> {{svg "octicon-code"}} {{$.locale.Tr "org.code"}} </a> {{end}} diff --git a/templates/user/overview/header.tmpl b/templates/user/overview/header.tmpl index ce9ecb46ad..b4f7d6f900 100644 --- a/templates/user/overview/header.tmpl +++ b/templates/user/overview/header.tmpl @@ -22,15 +22,17 @@ <a class="item" href="{{.ContextUser.HomeLink}}"> {{svg "octicon-repo"}} {{.locale.Tr "user.repositories"}} </a> + {{if and .IsProjectEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadProjects))}} <a href="{{.ContextUser.HomeLink}}/-/projects" class="{{if .PageIsViewProjects}}active {{end}}item"> {{svg "octicon-project-symlink"}} {{.locale.Tr "user.projects"}} </a> - {{if (not .UnitPackagesGlobalDisabled)}} + {{end}} + {{if and .IsPackageEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadPackages))}} <a href="{{.ContextUser.HomeLink}}/-/packages" class="{{if .IsPackagesPage}}active {{end}}item"> {{svg "octicon-package"}} {{.locale.Tr "packages.title"}} </a> {{end}} - {{if .IsRepoIndexerEnabled}} + {{if and .IsRepoIndexerEnabled (or .ContextUser.IsIndividual (and .ContextUser.IsOrganization .CanReadCode))}} <a href="{{.ContextUser.HomeLink}}/-/code" class="{{if .IsCodePage}}active {{end}}item"> {{svg "octicon-code"}} {{.locale.Tr "user.code"}} </a> |