Categorize admin settings sidebar panel (#26030)

This PR reorganize and categorize the admin settings sidebar panel into
groups:

- User Accounts, User Emails, Organizations, Authentication Sources ->
Identity & Access
- Repositories, Packages -> Code Assets
- Webhooks, Applications -> Integrations

Before:

<img width="1346" alt="Screen Shot 2023-07-21 at 10 30 28"
src="https://github.com/go-gitea/gitea/assets/17645053/e0c5ae83-464f-4aaa-8bab-2c5258c9278d">

After:

all configurable settings enabled (package, oauth, webhook)

<img width="1153" alt="Screen Shot 2023-07-21 at 10 27 30"
src="https://github.com/go-gitea/gitea/assets/17645053/88acf3f5-0623-4307-8654-69c654d80874">

all configurable settings disabled (package, oauth, webhook)

<img width="1391" alt="Screen Shot 2023-07-21 at 10 25 19"
src="https://github.com/go-gitea/gitea/assets/17645053/9e13aa60-e75c-4077-afd6-3da9e0ae18dd">

only oauth enabled

<img width="1323" alt="Screen Shot 2023-07-21 at 10 26 23"
src="https://github.com/go-gitea/gitea/assets/17645053/ce4f9ec0-b141-4d5e-ac13-46d001724dc5">

only webhook enabled

<img width="1350" alt="Screen Shot 2023-07-21 at 10 26 55"
src="https://github.com/go-gitea/gitea/assets/17645053/702491bd-083e-44fa-82bc-52c4571e54ac">
This commit is contained in:
HesterG 2023-07-24 09:05:16 +08:00 committed by GitHub
parent 4e4a71f3a0
commit 24c3bb95ac
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 54 additions and 26 deletions

View file

@ -2627,10 +2627,13 @@ teams.invite.description = Please click the button below to join the team.
[admin] [admin]
dashboard = Dashboard dashboard = Dashboard
identity_access = Identity & Access
users = User Accounts users = User Accounts
organizations = Organizations organizations = Organizations
assets = Code Assets
repositories = Repositories repositories = Repositories
hooks = Webhooks hooks = Webhooks
integrations = Integrations
authentication = Authentication Sources authentication = Authentication Sources
emails = User Emails emails = User Emails
config = Configuration config = Configuration

View file

@ -4,35 +4,60 @@
<a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/admin"> <a class="{{if .PageIsAdminDashboard}}active {{end}}item" href="{{AppSubUrl}}/admin">
{{.locale.Tr "admin.dashboard"}} {{.locale.Tr "admin.dashboard"}}
</a> </a>
<a class="{{if .PageIsAdminUsers}}active {{end}}item" href="{{AppSubUrl}}/admin/users"> <details class="item toggleable-item" {{if or .PageIsAdminUsers .PageIsAdminEmails .PageIsAdminOrganizations .PageIsAdminAuthentications}}open{{end}}>
{{.locale.Tr "admin.users"}} <summary>{{.locale.Tr "admin.identity_access"}}</summary>
</a> <div class="menu">
<a class="{{if .PageIsAdminOrganizations}}active {{end}}item" href="{{AppSubUrl}}/admin/orgs"> <a class="{{if .PageIsAdminAuthentications}}active {{end}}item" href="{{AppSubUrl}}/admin/auths">
{{.locale.Tr "admin.organizations"}} {{.locale.Tr "admin.authentication"}}
</a> </a>
<a class="{{if .PageIsAdminRepositories}}active {{end}}item" href="{{AppSubUrl}}/admin/repos"> <a class="{{if .PageIsAdminOrganizations}}active {{end}}item" href="{{AppSubUrl}}/admin/orgs">
{{.locale.Tr "admin.repositories"}} {{.locale.Tr "admin.organizations"}}
</a> </a>
{{if .EnablePackages}} <a class="{{if .PageIsAdminUsers}}active {{end}}item" href="{{AppSubUrl}}/admin/users">
<a class="{{if .PageIsAdminPackages}}active {{end}}item" href="{{AppSubUrl}}/admin/packages"> {{.locale.Tr "admin.users"}}
{{.locale.Tr "packages.title"}} </a>
</a> <a class="{{if .PageIsAdminEmails}}active {{end}}item" href="{{AppSubUrl}}/admin/emails">
{{end}} {{.locale.Tr "admin.emails"}}
{{if not DisableWebhooks}} </a>
</div>
</details>
<details class="item toggleable-item" {{if or .PageIsAdminRepositories (and .EnablePackages .PageIsAdminPackages)}}open{{end}}>
<summary>{{.locale.Tr "admin.assets"}}</summary>
<div class="menu">
{{if .EnablePackages}}
<a class="{{if .PageIsAdminPackages}}active {{end}}item" href="{{AppSubUrl}}/admin/packages">
{{.locale.Tr "packages.title"}}
</a>
{{end}}
<a class="{{if .PageIsAdminRepositories}}active {{end}}item" href="{{AppSubUrl}}/admin/repos">
{{.locale.Tr "admin.repositories"}}
</a>
</div>
</details>
<!-- Webhooks and OAuth can be both disabled here, so add this if statement to display different ui -->
{{if and (not DisableWebhooks) .EnableOAuth2}}
<details class="item toggleable-item" {{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks .PageIsAdminApplications}}open{{end}}>
<summary>{{.locale.Tr "admin.integrations"}}</summary>
<div class="menu">
<a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/admin/applications">
{{.locale.Tr "settings.applications"}}
</a>
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/admin/hooks">
{{.locale.Tr "admin.hooks"}}
</a>
</div>
</details>
{{else}}
{{if not DisableWebhooks}}
<a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/admin/hooks"> <a class="{{if or .PageIsAdminDefaultHooks .PageIsAdminSystemHooks}}active {{end}}item" href="{{AppSubUrl}}/admin/hooks">
{{.locale.Tr "admin.hooks"}} {{.locale.Tr "admin.hooks"}}
</a> </a>
{{end}} {{end}}
<a class="{{if .PageIsAdminAuthentications}}active {{end}}item" href="{{AppSubUrl}}/admin/auths"> {{if .EnableOAuth2}}
{{.locale.Tr "admin.authentication"}} <a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/admin/applications">
</a> {{.locale.Tr "settings.applications"}}
<a class="{{if .PageIsAdminEmails}}active {{end}}item" href="{{AppSubUrl}}/admin/emails"> </a>
{{.locale.Tr "admin.emails"}} {{end}}
</a>
{{if .EnableOAuth2}}
<a class="{{if .PageIsAdminApplications}}active {{end}}item" href="{{AppSubUrl}}/admin/applications">
{{.locale.Tr "settings.applications"}}
</a>
{{end}} {{end}}
{{if .EnableActions}} {{if .EnableActions}}
<details class="item toggleable-item" {{if .PageIsSharedSettingsRunners}}open{{end}}> <details class="item toggleable-item" {{if .PageIsSharedSettingsRunners}}open{{end}}>