diff options
author | yp05327 | 2023-03-11 00:18:20 +0900 |
---|---|---|
committer | GitHub | 2023-03-10 09:18:20 -0600 |
commit | cf29ee6dd290525635a0e1b823506e81f845b978 (patch) | |
tree | 3f1a2635e6c78143f6dfa4d0f747142da92b73b9 /templates | |
parent | 2173f14708ff3b35d7821fc9b6dcb5fcd06b8494 (diff) |
Add missing tabs to org projects page (#22705)
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.
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 25f459c09..2a359d811 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 ce9ecb46a..b4f7d6f90 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> |