fix(web): match settings page titles to the UI (#40336)

Many settings pages had a generic or missing title, so browser tabs and
history named the wrong page. Titles now use the active sidebar label,
or the page header on sub-pages, and are set once where several handlers
render the same page. The user and org webhook list headers print the
title, so they now read "Webhooks" instead of "Settings".

| Page | Before | After |
| --- | --- | --- |
| Runners, secrets, Actions general, admin job queue | Actions |
Runners, Secrets, General, Job queue |
| User and org webhooks, org options, 2FA enroll, account and keys after
a form error | Settings | Webhooks, Organization, Enroll in Two-Factor
Authentication, Account, SSH / GPG Keys |
| Admin self check, OAuth2 app edit, repo public access, repo LFS
pointer files | (none), owner/repo | Self Check, Edit OAuth2
Application, Public Access, Find pointer files |
| Admin trace, new branch protection rule, package cleanup rules |
Monitoring, Branch Protection -, Packages | Trace, Add New Rule,
Add/Edit Cleanup Rule, Cleanup Rule Preview |
| Admin webhook add and edit | Add/Update Webhook | Add/Update System
Webhook, Add/Update Default Webhook |
| Sidebar on admin queue, admin webhook edit, user OAuth2 app edit | no
highlight | Queues, Webhooks, Applications |

Assisted-by: Claude Code:claude-opus-5-5
This commit is contained in:
silverwind authored and GitHub committed 2026-11-17 02:41:49 +00:00
1 parent 894a971fab
commit 055105d42f
31 files changed
+75 -86

No files matched your search

+1
View File
@@ -194,6 +194,7 @@ func DashboardPost(ctx *context.Context) {
}
func SelfCheck(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.self_check")
ctx.Data["PageIsAdminSelfCheck"] = true
ctx.Data["StartupProblems"] = setting.StartupProblems
-3
View File
@@ -47,7 +47,6 @@ func Applications(ctx *context.Context) {
// ApplicationsPost response for adding an oauth2 application
func ApplicationsPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
@@ -64,7 +63,6 @@ func EditApplication(ctx *context.Context) {
// EditApplicationPost response for editing oauth2 application
func EditApplicationPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
@@ -73,7 +71,6 @@ func EditApplicationPost(ctx *context.Context) {
// ApplicationsRegenerateSecret handles the post request for regenerating the secret
func ApplicationsRegenerateSecret(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsAdminApplications"] = true
oa := newOAuth2CommonHandlers()
+1 -1
View File
@@ -31,7 +31,7 @@ func QueueManage(ctx *context.Context) {
return
}
ctx.Data["Title"] = ctx.Tr("admin.monitor.queue", mq.GetName())
ctx.Data["PageIsAdminMonitor"] = true
ctx.Data["PageIsAdminMonitorQueue"] = true
ctx.Data["Queue"] = mq
ctx.HTML(http.StatusOK, tplQueueManage)
}
+1 -1
View File
@@ -13,7 +13,7 @@ import (
)
func monitorTraceCommon(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("admin.monitor")
ctx.Data["Title"] = ctx.Tr("admin.monitor.trace")
ctx.Data["PageIsAdminMonitorTrace"] = true
// Hide the performance trace tab in production, because it shows a lot of SQLs and is not that useful for end users.
// To avoid confusing end users, do not let them know this tab. End users should "download diagnosis report" instead.
+3 -3
View File
@@ -42,7 +42,7 @@ const (
// Settings render the main settings page
func Settings(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("org.settings")
ctx.Data["Title"] = ctx.Tr("org.settings.options")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsOptions"] = true
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
@@ -60,7 +60,7 @@ func Settings(ctx *context.Context) {
// SettingsPost response for settings change submitted
func SettingsPost(ctx *context.Context) {
form := web.GetForm[*forms.UpdateOrgSettingForm](ctx)
ctx.Data["Title"] = ctx.Tr("org.settings")
ctx.Data["Title"] = ctx.Tr("org.settings.options")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsOptions"] = true
ctx.Data["CurrentVisibility"] = ctx.Org.Organization.Visibility
@@ -149,7 +149,7 @@ func SettingsDeleteOrgPost(ctx *context.Context) {
// Webhooks render webhook list page
func Webhooks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("org.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["BaseLink"] = ctx.Org.OrgLink + "/settings/hooks"
-3
View File
@@ -55,7 +55,6 @@ func Applications(ctx *context.Context) {
// OAuthApplicationsPost response for adding an oauth2 application
func OAuthApplicationsPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsApplications"] = true
@@ -74,7 +73,6 @@ func OAuth2ApplicationShow(ctx *context.Context) {
// OAuth2ApplicationEdit response for editing oauth2 application
func OAuth2ApplicationEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.applications")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsApplications"] = true
@@ -84,7 +82,6 @@ func OAuth2ApplicationEdit(ctx *context.Context) {
// OAuthApplicationsRegenerateSecret handles the post request for regenerating the secret
func OAuthApplicationsRegenerateSecret(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsApplications"] = true
-5
View File
@@ -36,7 +36,6 @@ func Packages(ctx *context.Context) {
}
func PackagesRuleAdd(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsPackages"] = true
@@ -51,7 +50,6 @@ func PackagesRuleAdd(ctx *context.Context) {
}
func PackagesRuleEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsPackages"] = true
@@ -66,7 +64,6 @@ func PackagesRuleEdit(ctx *context.Context) {
}
func PackagesRuleAddPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsPackages"] = true
@@ -79,7 +76,6 @@ func PackagesRuleAddPost(ctx *context.Context) {
}
func PackagesRuleEditPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsPackages"] = true
@@ -92,7 +88,6 @@ func PackagesRuleEditPost(ctx *context.Context) {
}
func PackagesRulePreview(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsOrgSettings"] = true
ctx.Data["PageIsSettingsPackages"] = true
+1
View File
@@ -387,6 +387,7 @@ func LFSPointerFiles(ctx *context.Context) {
ctx.NotFound()
return
}
ctx.Data["Title"] = ctx.Tr("repo.settings.lfs_findpointerfiles")
ctx.Data["PageIsSettingsLFS"] = true
ctx.Data["LFSFilesLink"] = ctx.Repo.RepoLink + "/settings/lfs"
+5 -1
View File
@@ -74,7 +74,11 @@ func SettingsProtectedBranch(c *context.Context) {
}
c.Data["PageIsSettingsBranches"] = true
c.Data["Title"] = c.Locale.TrString("repo.settings.protected_branch") + " - " + rule.RuleName
if rule.RuleName == "" {
c.Data["Title"] = c.Locale.TrString("repo.settings.branches.add_new_rule")
} else {
c.Data["Title"] = c.Locale.TrString("repo.settings.protected_branch") + " - " + rule.RuleName
}
repoUsers, err := access_model.GetUsersWithAnyUnitAccess(c, c.Repo.Repository, perm.AccessModeRead, unit.TypeCode, unit.TypePullRequests)
if err != nil {
@@ -125,6 +125,7 @@ func repoUnitPublicAccesses(ctx *context.Context) []*repoUnitPublicAccess {
}
func PublicAccess(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.public_access")
ctx.Data["PageIsSettingsPublicAccess"] = true
ctx.Data["RepoUnitPublicAccesses"] = repoUnitPublicAccesses(ctx)
ctx.Data["GlobalForcePrivate"] = setting.Repository.ForcePrivate
+1 -1
View File
@@ -74,7 +74,7 @@ func getSecretsCtx(ctx *context.Context) (*secretsCtx, error) {
}
func Secrets(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["Title"] = ctx.Tr("secrets.secrets")
ctx.Data["PageType"] = "secrets"
ctx.Data["PageIsSharedSettingsSecrets"] = true
+17 -19
View File
@@ -116,6 +116,19 @@ func getOwnerRepoCtx(ctx *context.Context) (*ownerRepoCtx, error) {
return nil, errors.New("unable to set OwnerRepo context")
}
func (orCtx *ownerRepoCtx) setFormPageData(ctx *context.Context, isNew, isSystemWebhook bool) {
if !orCtx.IsAdmin {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["Title"] = util.Iif(isNew, ctx.Tr("repo.settings.add_webhook"), ctx.Tr("repo.settings.update_webhook"))
} else if isSystemWebhook {
ctx.Data["PageIsAdminSystemHooks"] = true
ctx.Data["Title"] = util.Iif(isNew, ctx.Tr("admin.systemhooks.add_webhook"), ctx.Tr("admin.systemhooks.update_webhook"))
} else {
ctx.Data["PageIsAdminDefaultHooks"] = true
ctx.Data["Title"] = util.Iif(isNew, ctx.Tr("admin.defaulthooks.add_webhook"), ctx.Tr("admin.defaulthooks.update_webhook"))
}
}
// recordWebhookAudit emits a webhook audit event scoped to the repository,
// organization, user, or instance (admin/system) the webhook belongs to. The
// shared add/edit handlers run in any of these contexts, so the scope is derived
@@ -135,7 +148,6 @@ func checkHookType(ctx *context.Context) string {
// WebhooksNew render creating webhook page
func WebhooksNew(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
ctx.Data["Webhook"] = webhook.Webhook{HookEvent: &webhook_module.HookEvent{}}
orCtx, err := getOwnerRepoCtx(ctx)
@@ -143,17 +155,7 @@ func WebhooksNew(ctx *context.Context) {
ctx.ServerErrorAuto(err)
return
}
if orCtx.IsAdmin && orCtx.IsSystemWebhook {
ctx.Data["PageIsAdminSystemHooks"] = true
ctx.Data["PageIsAdminSystemHooksNew"] = true
} else if orCtx.IsAdmin {
ctx.Data["PageIsAdminDefaultHooks"] = true
ctx.Data["PageIsAdminDefaultHooksNew"] = true
} else {
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
}
orCtx.setFormPageData(ctx, true, orCtx.IsSystemWebhook)
hookType := checkHookType(ctx)
ctx.Data["HookType"] = hookType
@@ -219,9 +221,6 @@ type webhookParams struct {
}
func createWebhook(ctx *context.Context, params webhookParams) {
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksNew"] = true
ctx.Data["Webhook"] = webhook.Webhook{HookEvent: &webhook_module.HookEvent{}}
ctx.Data["HookType"] = params.Type
@@ -230,6 +229,7 @@ func createWebhook(ctx *context.Context, params webhookParams) {
ctx.ServerErrorAuto(err)
return
}
orCtx.setFormPageData(ctx, true, orCtx.IsSystemWebhook)
ctx.Data["BaseLink"] = orCtx.LinkNew
if ctx.HasError() {
@@ -280,14 +280,13 @@ func createWebhook(ctx *context.Context, params webhookParams) {
}
func editWebhook(ctx *context.Context, params webhookParams) {
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
orCtx, w := checkWebhook(ctx)
if ctx.Written() {
return
}
orCtx.setFormPageData(ctx, false, w.IsSystemWebhook)
ctx.Data["Webhook"] = w
if ctx.HasError() {
@@ -656,14 +655,13 @@ func checkWebhook(ctx *context.Context) (*ownerRepoCtx, *webhook.Webhook) {
// WebHooksEdit render editing web hook page
func WebHooksEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["PageIsSettingsHooksEdit"] = true
orCtx, w := checkWebhook(ctx)
if ctx.Written() {
return
}
orCtx.setFormPageData(ctx, false, w.IsSystemWebhook)
ctx.Data["Webhook"] = w
ctx.HTML(http.StatusOK, orCtx.NewTemplate)
+1 -1
View File
@@ -45,7 +45,7 @@ func ParseMaxTokenPermissions(ctx *context.Context) *repo_model.ActionsTokenPerm
// GeneralSettings renders the actions general settings page
func GeneralSettings(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["Title"] = ctx.Tr("actions.general")
rCtx, err := getRunnersCtx(ctx)
if err != nil {
+1 -1
View File
@@ -24,7 +24,7 @@ import (
// JobQueue renders the instance-wide Actions job queue on the admin settings page.
func JobQueue(ctx *context.Context) {
ctx.Data["PageIsSharedSettingsActionsJobQueue"] = true
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["Title"] = ctx.Tr("actions.job_queue.title")
ctx.Data["PageType"] = "job_queue"
RenderJobQueue(ctx, 0, "admin/actions")
+1 -1
View File
@@ -100,7 +100,7 @@ func getRunnersCtx(ctx *context.Context) (*runnersCtx, error) {
// Runners render settings/actions/runners page for repo level
func Runners(ctx *context.Context) {
ctx.Data["PageIsSharedSettingsRunners"] = true
ctx.Data["Title"] = ctx.Tr("actions.actions")
ctx.Data["Title"] = ctx.Tr("actions.runners")
ctx.Data["PageType"] = "runners"
rCtx, err := getRunnersCtx(ctx)
+8 -9
View File
@@ -13,6 +13,7 @@ import (
"gitea.dev/modules/log"
"gitea.dev/modules/optional"
"gitea.dev/modules/templates"
"gitea.dev/modules/util"
"gitea.dev/modules/web"
"gitea.dev/services/context"
"gitea.dev/services/forms"
@@ -31,7 +32,7 @@ func SetPackagesContext(ctx *context.Context, owner *user_model.User) {
}
func SetRuleAddContext(ctx *context.Context) {
setRuleEditContext(ctx, nil)
setRuleEditContext(ctx, &packages_model.PackageCleanupRule{})
}
func SetRuleEditContext(ctx *context.Context, owner *user_model.User) {
@@ -44,11 +45,9 @@ func SetRuleEditContext(ctx *context.Context, owner *user_model.User) {
}
func setRuleEditContext(ctx *context.Context, pcr *packages_model.PackageCleanupRule) {
ctx.Data["IsEditRule"] = pcr != nil
if pcr == nil {
pcr = &packages_model.PackageCleanupRule{}
}
isEditRule := pcr.ID != 0
ctx.Data["Title"] = util.Iif(isEditRule, ctx.Tr("packages.owner.settings.cleanuprules.edit"), ctx.Tr("packages.owner.settings.cleanuprules.add"))
ctx.Data["IsEditRule"] = isEditRule
ctx.Data["CleanupRule"] = pcr
ctx.Data["AvailableTypes"] = packages_model.TypeList
}
@@ -95,9 +94,7 @@ func performRuleEditPost(ctx *context.Context, owner *user_model.User, pcr *pack
pcr.RemovePattern = form.RemovePattern
pcr.MatchFullName = form.MatchFullName
ctx.Data["IsEditRule"] = isEditRule
ctx.Data["CleanupRule"] = pcr
ctx.Data["AvailableTypes"] = packages_model.TypeList
setRuleEditContext(ctx, pcr)
if ctx.HasError() {
ctx.HTML(http.StatusOK, template)
@@ -134,6 +131,8 @@ func performRuleEditPost(ctx *context.Context, owner *user_model.User, pcr *pack
}
func SetRulePreviewContext(ctx *context.Context, owner *user_model.User) {
ctx.Data["Title"] = ctx.Tr("packages.owner.settings.cleanuprules.preview")
pcr := getCleanupRuleByContext(ctx, owner)
if pcr == nil {
return
+1 -3
View File
@@ -43,7 +43,6 @@ func Account(ctx *context.Context) {
return
}
ctx.Data["Title"] = ctx.Tr("settings.account")
ctx.Data["PageIsSettingsAccount"] = true
ctx.Data["Email"] = ctx.Doer.Email
@@ -60,7 +59,6 @@ func AccountPost(ctx *context.Context) {
}
form := web.GetForm[*forms.ChangePasswordForm](ctx)
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsAccount"] = true
ctx.Data["Email"] = ctx.Doer.Email
@@ -110,7 +108,6 @@ func EmailPost(ctx *context.Context) {
}
form := web.GetForm[*forms.AddEmailForm](ctx)
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsAccount"] = true
ctx.Data["Email"] = ctx.Doer.Email
@@ -293,6 +290,7 @@ func DeleteAccount(ctx *context.Context) {
}
func loadAccountData(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.account")
emlist, err := user_model.GetEmailAddresses(ctx, ctx.Doer.ID)
if err != nil {
ctx.ServerErrorAuto(err)
+1 -2
View File
@@ -32,7 +32,6 @@ func Keys(ctx *context.Context) {
return
}
ctx.Data["Title"] = ctx.Tr("settings.ssh_gpg_keys")
ctx.Data["PageIsSettingsKeys"] = true
ctx.Data["DisableSSH"] = setting.SSH.Disabled
ctx.Data["BuiltinSSH"] = setting.SSH.StartBuiltinServer
@@ -46,7 +45,6 @@ func Keys(ctx *context.Context) {
// KeysPost response for change user's SSH/GPG keys
func KeysPost(ctx *context.Context) {
form := web.GetForm[*forms.AddKeyForm](ctx)
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsKeys"] = true
ctx.Data["DisableSSH"] = setting.SSH.Disabled
ctx.Data["BuiltinSSH"] = setting.SSH.StartBuiltinServer
@@ -316,6 +314,7 @@ func DeleteKey(ctx *context.Context) {
}
func loadKeysData(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings.ssh_gpg_keys")
keys, err := db.Find[asymkey_model.PublicKey](ctx, asymkey_model.FindPublicKeyOptions{
OwnerID: ctx.Doer.ID,
NotKeytype: asymkey_model.KeyTypePrincipal,
+2 -3
View File
@@ -25,7 +25,6 @@ func newOAuth2CommonHandlers(owner *user_model.User) *OAuth2CommonHandlers {
// OAuthApplicationsPost response for adding a oauth2 application
func OAuthApplicationsPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsApplications"] = true
oa := newOAuth2CommonHandlers(ctx.Doer)
@@ -34,7 +33,6 @@ func OAuthApplicationsPost(ctx *context.Context) {
// OAuthApplicationsEdit response for editing oauth2 application
func OAuthApplicationsEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsApplications"] = true
oa := newOAuth2CommonHandlers(ctx.Doer)
@@ -43,7 +41,6 @@ func OAuthApplicationsEdit(ctx *context.Context) {
// OAuthApplicationsRegenerateSecret handles the post request for regenerating the secret
func OAuthApplicationsRegenerateSecret(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsApplications"] = true
oa := newOAuth2CommonHandlers(ctx.Doer)
@@ -52,6 +49,8 @@ func OAuthApplicationsRegenerateSecret(ctx *context.Context) {
// OAuth2ApplicationShow displays the given application
func OAuth2ApplicationShow(ctx *context.Context) {
ctx.Data["PageIsSettingsApplications"] = true
oa := newOAuth2CommonHandlers(ctx.Doer)
oa.EditShow(ctx)
}
@@ -39,6 +39,7 @@ func (oa *OAuth2CommonHandlers) recordAudit(ctx *context.Context, actions audit.
}
func (oa *OAuth2CommonHandlers) renderEditPage(ctx *context.Context, app *auth.OAuth2Application) {
ctx.Data["Title"] = ctx.Tr("settings.edit_oauth2_application")
ctx.Data["App"] = app
ctx.Data["FormActionPath"] = fmt.Sprintf("%s/%d", oa.BasePathEditPrefix, app.ID)
-5
View File
@@ -32,7 +32,6 @@ func Packages(ctx *context.Context) {
}
func PackagesRuleAdd(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsSettingsPackages"] = true
shared.SetRuleAddContext(ctx)
@@ -41,7 +40,6 @@ func PackagesRuleAdd(ctx *context.Context) {
}
func PackagesRuleEdit(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsSettingsPackages"] = true
shared.SetRuleEditContext(ctx, ctx.Doer)
@@ -50,7 +48,6 @@ func PackagesRuleEdit(ctx *context.Context) {
}
func PackagesRuleAddPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["PageIsSettingsPackages"] = true
shared.PerformRuleAddPost(
@@ -62,7 +59,6 @@ func PackagesRuleAddPost(ctx *context.Context) {
}
func PackagesRuleEditPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsSettingsPackages"] = true
shared.PerformRuleEditPost(
@@ -74,7 +70,6 @@ func PackagesRuleEditPost(ctx *context.Context) {
}
func PackagesRulePreview(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("packages.title")
ctx.Data["PageIsSettingsPackages"] = true
shared.SetRulePreviewContext(ctx, ctx.Doer)
+2 -2
View File
@@ -167,7 +167,7 @@ func EnrollTwoFactor(ctx *context.Context) {
return
}
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["Title"] = ctx.Tr("settings.twofa_enroll")
ctx.Data["PageIsSettingsSecurity"] = true
ctx.Data["ShowTwoFactorRequiredMessage"] = false
@@ -199,7 +199,7 @@ func EnrollTwoFactorPost(ctx *context.Context) {
}
form := web.GetForm[*forms.TwoFactorAuthForm](ctx)
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["Title"] = ctx.Tr("settings.twofa_enroll")
ctx.Data["PageIsSettingsSecurity"] = true
ctx.Data["ShowTwoFactorRequiredMessage"] = false
+1 -1
View File
@@ -20,7 +20,7 @@ const (
// Webhooks render webhook list page
func Webhooks(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings_title")
ctx.Data["Title"] = ctx.Tr("repo.settings.hooks")
ctx.Data["PageIsSettingsHooks"] = true
ctx.Data["BaseLink"] = setting.AppSubURL + "/user/settings/hooks"
ctx.Data["BaseLinkNew"] = setting.AppSubURL + "/user/settings/hooks"
+1 -9
View File
@@ -1,13 +1,5 @@
{{template "admin/layout_head" (dict "pageClass" "admin settings new webhook")}}
<div class="admin-setting-content">
{{$CustomHeaderTitle := ctx.Locale.Tr "admin.defaulthooks.update_webhook"}}
{{if .PageIsAdminDefaultHooksNew}}
{{$CustomHeaderTitle = ctx.Locale.Tr "admin.defaulthooks.add_webhook"}}
{{else if .PageIsAdminSystemHooksNew}}
{{$CustomHeaderTitle = ctx.Locale.Tr "admin.systemhooks.add_webhook"}}
{{else if .Webhook.IsSystemWebhook}}
{{$CustomHeaderTitle = ctx.Locale.Tr "admin.systemhooks.update_webhook"}}
{{end}}
{{template "webhook/new" (dict "CustomHeaderTitle" $CustomHeaderTitle)}}
{{template "webhook/new"}}
</div>
{{template "admin/layout_footer" .}}
+1 -3
View File
@@ -1,7 +1,5 @@
{{template "org/settings/layout_head" (dict "pageClass" "organization settings new webhook")}}
<div class="org-setting-content">
{{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "CustomHeaderTitle" $CustomHeaderTitle)}}
{{template "webhook/new"}}
</div>
{{template "org/settings/layout_footer" .}}
+1 -1
View File
@@ -29,7 +29,7 @@
<details class="item" {{if or .PageIsOrgSettingsActionsGeneral .PageIsSharedSettingsRunners .PageIsSharedSettingsSecrets .PageIsSharedSettingsVariables .PageIsSharedSettingsScopedWorkflows}}open{{end}}>
<summary>{{ctx.Locale.Tr "actions.actions"}}</summary>
<div class="menu">
<a class="{{if .PageIsOrgSettingsActionsGeneral}}active {{end}}item" href="{{.OrgLink}}/settings/actions">
<a class="{{if .PageIsOrgSettingsActionsGeneral}}active {{end}}item" href="{{.OrgLink}}/settings/actions/general">
{{ctx.Locale.Tr "settings.general"}}
</a>
<a class="{{if .PageIsSharedSettingsRunners}}active {{end}}item" href="{{.OrgLink}}/settings/actions/runners">
@@ -1,4 +1,4 @@
<h4 class="ui top attached header">{{if .IsEditRule}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.edit"}}{{else}}{{ctx.Locale.Tr "packages.owner.settings.cleanuprules.add"}}{{end}}</h4>
<h4 class="ui top attached header">{{.Title}}</h4>
<div class="ui attached segment">
<form class="ui form" action="{{.Link}}" method="post">
<input name="id" type="hidden" value="{{.CleanupRule.ID}}">
+1 -3
View File
@@ -1,7 +1,5 @@
{{template "repo/settings/layout_head" (dict "pageClass" "repository settings new webhook")}}
<div class="repo-setting-content">
{{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "CustomHeaderTitle" $CustomHeaderTitle)}}
{{template "webhook/new"}}
</div>
{{template "repo/settings/layout_footer" .}}
+1 -3
View File
@@ -1,7 +1,5 @@
{{template "user/settings/layout_head" (dict "pageClass" "user settings new webhook")}}
<div class="user-setting-content">
{{$CustomHeaderTitle := ctx.Locale.Tr "repo.settings.update_webhook"}}
{{if .PageIsSettingsHooksNew}}{{$CustomHeaderTitle = ctx.Locale.Tr "repo.settings.add_webhook"}}{{end}}
{{template "webhook/new" (dict "CustomHeaderTitle" $CustomHeaderTitle)}}
{{template "webhook/new"}}
</div>
{{template "user/settings/layout_footer" .}}
+1 -1
View File
@@ -1,5 +1,5 @@
<h4 class="ui top attached header">
{{.CustomHeaderTitle}}
{{ctx.RootData.Title}}
<div class="ui right type dropdown">
<div class="text flex-text-inline">
{{template "shared/webhook/icon" (dict "Size" 20 "HookType" ctx.RootData.HookType)}}
+18
View File
@@ -5,12 +5,14 @@ package integration
import (
"net/http"
"strings"
"testing"
"gitea.dev/modules/setting"
"gitea.dev/modules/test"
"gitea.dev/tests"
"github.com/PuerkitoBio/goquery"
"github.com/stretchr/testify/assert"
)
@@ -80,6 +82,22 @@ func TestSettingShowUserEmailProfile(t *testing.T) {
setting.UI.ShowUserEmail = showUserEmail
}
func TestSettingPageTitlesMatchNavbar(t *testing.T) {
defer tests.PrepareTestEnv(t)()
session := loginUser(t, "user1")
for _, root := range []string{"/-/admin", "/user/settings", "/org/org3/settings", "/user2/repo2/settings"} {
resp := session.MakeRequest(t, NewRequest(t, "GET", root), http.StatusOK)
NewHTMLParser(t, resp.Body).Find(".flex-container-nav a.item").Each(func(_ int, link *goquery.Selection) {
href := link.AttrOr("href", "")
resp := session.MakeRequest(t, NewRequest(t, "GET", href), http.StatusOK)
page := NewHTMLParser(t, resp.Body)
pageTitle, _, _ := strings.Cut(page.Find("title").Text(), " - ")
assert.Equal(t, strings.TrimSpace(page.Find(".flex-container-nav a.active.item").Text()), pageTitle, href)
})
}
}
func TestSettingLandingPage(t *testing.T) {
defer tests.PrepareTestEnv(t)()
defer test.MockVariableValue(&setting.LandingPageURL)()