From 055105d42f7c384a89bc1d6577c0ecaaa64cb5d1 Mon Sep 17 00:00:00 2001 From: silverwind Date: Tue, 17 Nov 2026 02:41:49 +0000 Subject: [PATCH] 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 --- routers/web/admin/admin.go | 1 + routers/web/admin/applications.go | 3 -- routers/web/admin/queue.go | 2 +- routers/web/admin/stacktrace.go | 2 +- routers/web/org/setting.go | 6 ++-- routers/web/org/setting_oauth2.go | 3 -- routers/web/org/setting_packages.go | 5 --- routers/web/repo/setting/lfs.go | 1 + routers/web/repo/setting/protected_branch.go | 6 +++- routers/web/repo/setting/public_access.go | 1 + routers/web/repo/setting/secrets.go | 2 +- routers/web/repo/setting/webhook.go | 36 +++++++++---------- routers/web/shared/actions/general.go | 2 +- routers/web/shared/actions/job_queue.go | 2 +- routers/web/shared/actions/runners.go | 2 +- routers/web/shared/packages/packages.go | 17 +++++---- routers/web/user/setting/account.go | 4 +-- routers/web/user/setting/keys.go | 3 +- routers/web/user/setting/oauth2.go | 5 ++- routers/web/user/setting/oauth2_common.go | 1 + routers/web/user/setting/packages.go | 5 --- routers/web/user/setting/security/2fa.go | 4 +-- routers/web/user/setting/webhooks.go | 2 +- templates/admin/hook_new.tmpl | 10 +----- templates/org/settings/hook_new.tmpl | 4 +-- templates/org/settings/navbar.tmpl | 2 +- .../package/shared/cleanup_rules/edit.tmpl | 2 +- templates/repo/settings/webhook/new.tmpl | 4 +-- templates/user/settings/hook_new.tmpl | 4 +-- templates/webhook/new.tmpl | 2 +- tests/integration/setting_test.go | 18 ++++++++++ 31 files changed, 75 insertions(+), 86 deletions(-) diff --git a/routers/web/admin/admin.go b/routers/web/admin/admin.go index a347211f9c6..573ee4ea02b 100644 --- a/routers/web/admin/admin.go +++ b/routers/web/admin/admin.go @@ -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 diff --git a/routers/web/admin/applications.go b/routers/web/admin/applications.go index b454b49a78b..f349e1045a5 100644 --- a/routers/web/admin/applications.go +++ b/routers/web/admin/applications.go @@ -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() diff --git a/routers/web/admin/queue.go b/routers/web/admin/queue.go index 499f6e68ce0..1ff725df320 100644 --- a/routers/web/admin/queue.go +++ b/routers/web/admin/queue.go @@ -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) } diff --git a/routers/web/admin/stacktrace.go b/routers/web/admin/stacktrace.go index 4803b508e91..d43bf0331ae 100644 --- a/routers/web/admin/stacktrace.go +++ b/routers/web/admin/stacktrace.go @@ -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. diff --git a/routers/web/org/setting.go b/routers/web/org/setting.go index 4d7c2aaae03..e16fe908899 100644 --- a/routers/web/org/setting.go +++ b/routers/web/org/setting.go @@ -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" diff --git a/routers/web/org/setting_oauth2.go b/routers/web/org/setting_oauth2.go index 7c85cf3a106..3efb7b1e780 100644 --- a/routers/web/org/setting_oauth2.go +++ b/routers/web/org/setting_oauth2.go @@ -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 diff --git a/routers/web/org/setting_packages.go b/routers/web/org/setting_packages.go index c91724da6e3..e7ccfcdbd1a 100644 --- a/routers/web/org/setting_packages.go +++ b/routers/web/org/setting_packages.go @@ -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 diff --git a/routers/web/repo/setting/lfs.go b/routers/web/repo/setting/lfs.go index 641d3db89a4..b8e8d8d1bc3 100644 --- a/routers/web/repo/setting/lfs.go +++ b/routers/web/repo/setting/lfs.go @@ -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" diff --git a/routers/web/repo/setting/protected_branch.go b/routers/web/repo/setting/protected_branch.go index 6d4da26cd15..34a656fbcf7 100644 --- a/routers/web/repo/setting/protected_branch.go +++ b/routers/web/repo/setting/protected_branch.go @@ -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 { diff --git a/routers/web/repo/setting/public_access.go b/routers/web/repo/setting/public_access.go index 4ff49e747e2..9f6b1dcc68f 100644 --- a/routers/web/repo/setting/public_access.go +++ b/routers/web/repo/setting/public_access.go @@ -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 diff --git a/routers/web/repo/setting/secrets.go b/routers/web/repo/setting/secrets.go index d9c6f4c4c5b..82d898118d2 100644 --- a/routers/web/repo/setting/secrets.go +++ b/routers/web/repo/setting/secrets.go @@ -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 diff --git a/routers/web/repo/setting/webhook.go b/routers/web/repo/setting/webhook.go index 215f96d4fec..3c74ebc4f39 100644 --- a/routers/web/repo/setting/webhook.go +++ b/routers/web/repo/setting/webhook.go @@ -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) diff --git a/routers/web/shared/actions/general.go b/routers/web/shared/actions/general.go index b82933d32b5..16b7b79e7b2 100644 --- a/routers/web/shared/actions/general.go +++ b/routers/web/shared/actions/general.go @@ -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 { diff --git a/routers/web/shared/actions/job_queue.go b/routers/web/shared/actions/job_queue.go index dd78779c033..547bf7722d8 100644 --- a/routers/web/shared/actions/job_queue.go +++ b/routers/web/shared/actions/job_queue.go @@ -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") diff --git a/routers/web/shared/actions/runners.go b/routers/web/shared/actions/runners.go index 656ff8b38ea..e21e02e051d 100644 --- a/routers/web/shared/actions/runners.go +++ b/routers/web/shared/actions/runners.go @@ -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) diff --git a/routers/web/shared/packages/packages.go b/routers/web/shared/packages/packages.go index 11bd32443c8..7aec1fb6817 100644 --- a/routers/web/shared/packages/packages.go +++ b/routers/web/shared/packages/packages.go @@ -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 diff --git a/routers/web/user/setting/account.go b/routers/web/user/setting/account.go index 33a81ee3e26..979182986d9 100644 --- a/routers/web/user/setting/account.go +++ b/routers/web/user/setting/account.go @@ -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) diff --git a/routers/web/user/setting/keys.go b/routers/web/user/setting/keys.go index f73cc7721c3..b3c35a08133 100644 --- a/routers/web/user/setting/keys.go +++ b/routers/web/user/setting/keys.go @@ -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, diff --git a/routers/web/user/setting/oauth2.go b/routers/web/user/setting/oauth2.go index 696c1eeace7..4d0ba5d6888 100644 --- a/routers/web/user/setting/oauth2.go +++ b/routers/web/user/setting/oauth2.go @@ -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) } diff --git a/routers/web/user/setting/oauth2_common.go b/routers/web/user/setting/oauth2_common.go index 3f2290b28cd..26bbd6ba460 100644 --- a/routers/web/user/setting/oauth2_common.go +++ b/routers/web/user/setting/oauth2_common.go @@ -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) diff --git a/routers/web/user/setting/packages.go b/routers/web/user/setting/packages.go index 2d9209b41e5..c7b5e6a36de 100644 --- a/routers/web/user/setting/packages.go +++ b/routers/web/user/setting/packages.go @@ -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) diff --git a/routers/web/user/setting/security/2fa.go b/routers/web/user/setting/security/2fa.go index b3054949976..b8d810a10ac 100644 --- a/routers/web/user/setting/security/2fa.go +++ b/routers/web/user/setting/security/2fa.go @@ -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 diff --git a/routers/web/user/setting/webhooks.go b/routers/web/user/setting/webhooks.go index 13acd34cff8..31ee6ad5974 100644 --- a/routers/web/user/setting/webhooks.go +++ b/routers/web/user/setting/webhooks.go @@ -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" diff --git a/templates/admin/hook_new.tmpl b/templates/admin/hook_new.tmpl index d8df2054495..28edd6d9572 100644 --- a/templates/admin/hook_new.tmpl +++ b/templates/admin/hook_new.tmpl @@ -1,13 +1,5 @@ {{template "admin/layout_head" (dict "pageClass" "admin settings new webhook")}}
- {{$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"}}
{{template "admin/layout_footer" .}} diff --git a/templates/org/settings/hook_new.tmpl b/templates/org/settings/hook_new.tmpl index 11f71d9059b..14bd2e1644a 100644 --- a/templates/org/settings/hook_new.tmpl +++ b/templates/org/settings/hook_new.tmpl @@ -1,7 +1,5 @@ {{template "org/settings/layout_head" (dict "pageClass" "organization settings new webhook")}}
- {{$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"}}
{{template "org/settings/layout_footer" .}} diff --git a/templates/org/settings/navbar.tmpl b/templates/org/settings/navbar.tmpl index a42f43984fb..aa5fe07ff4b 100644 --- a/templates/org/settings/navbar.tmpl +++ b/templates/org/settings/navbar.tmpl @@ -29,7 +29,7 @@
{{ctx.Locale.Tr "actions.actions"}}