Skip to content

Commit

Permalink
Add main landmark to templates and adjust titles (go-gitea#22670)
Browse files Browse the repository at this point in the history
* Add main aria landmark to templates
 * Adjust some titles to improve understanding of location in navigation

Contributed by @forgejo

(cherry picked from commit e6a557cae3ad2db1bbb9a5ee7b90531b3bbc5c3f)
  • Loading branch information
fsologureng authored and Loïc Dachary committed Feb 20, 2023
1 parent 54eb945 commit fb45bf2
Show file tree
Hide file tree
Showing 158 changed files with 164 additions and 163 deletions.
1 change: 1 addition & 0 deletions routers/web/admin/hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const (
func DefaultOrSystemWebhooks(ctx *context.Context) {
var err error

ctx.Data["Title"] = ctx.Tr("admin.hooks")
ctx.Data["PageIsAdminSystemHooks"] = true
ctx.Data["PageIsAdminDefaultHooks"] = true

Expand Down
6 changes: 3 additions & 3 deletions routers/web/repo/setting.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const (
// SettingsCtxData is a middleware that sets all the general context data for the
// settings template.
func SettingsCtxData(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.options")
ctx.Data["PageIsSettingsOptions"] = true
ctx.Data["ForcePrivate"] = setting.Repository.ForcePrivate
ctx.Data["MirrorsEnabled"] = setting.Mirror.Enabled
Expand Down Expand Up @@ -854,7 +854,7 @@ func handleSettingRemoteAddrError(ctx *context.Context, err error, form *forms.R

// Collaboration render a repository's collaboration page
func Collaboration(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.collaboration")
ctx.Data["PageIsSettingsCollaboration"] = true

users, err := repo_model.GetCollaborators(ctx, ctx.Repo.Repository.ID, db.ListOptions{})
Expand Down Expand Up @@ -1093,7 +1093,7 @@ func GitHooksEditPost(ctx *context.Context) {

// DeployKeys render the deploy keys list of a repository page
func DeployKeys(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys")
ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys") + " / " + ctx.Tr("secrets.secrets")
ctx.Data["PageIsSettingsKeys"] = true
ctx.Data["DisableSSH"] = setting.SSH.Disabled

Expand Down
4 changes: 2 additions & 2 deletions routers/web/repo/setting_protected_branch.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import (

// ProtectedBranch render the page to protect the repository
func ProtectedBranch(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.branches")
ctx.Data["PageIsSettingsBranches"] = true

protectedBranches, err := git_model.GetProtectedBranches(ctx.Repo.Repository.ID)
Expand Down Expand Up @@ -61,7 +61,7 @@ func ProtectedBranch(ctx *context.Context) {

// ProtectedBranchPost response for protect for a branch of a repository
func ProtectedBranchPost(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.protected_branch")
ctx.Data["PageIsSettingsBranches"] = true

repo := ctx.Repo.Repository
Expand Down
2 changes: 1 addition & 1 deletion routers/web/repo/tag.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func DeleteProtectedTagPost(ctx *context.Context) {
}

func setTagsContext(ctx *context.Context) error {
ctx.Data["Title"] = ctx.Tr("repo.settings")
ctx.Data["Title"] = ctx.Tr("repo.settings.tags")
ctx.Data["PageIsSettingsTags"] = true

protectedTags, err := git_model.GetProtectedTags(ctx.Repo.Repository.ID)
Expand Down
2 changes: 1 addition & 1 deletion routers/web/user/setting/account.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const (

// Account renders change user's password, user's email and user suicide page
func Account(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.account")
ctx.Data["PageIsSettingsAccount"] = true
ctx.Data["Email"] = ctx.Doer.Email
ctx.Data["EnableNotifyMail"] = setting.Service.EnableNotifyMail
Expand Down
2 changes: 1 addition & 1 deletion routers/web/user/setting/adopt.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import (

// AdoptOrDeleteRepository adopts or deletes a repository
func AdoptOrDeleteRepository(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.adopt")
ctx.Data["PageIsSettingsRepos"] = true
allowAdopt := ctx.IsUserSiteAdmin() || setting.Repository.AllowAdoptionOfUnadoptedRepositories
ctx.Data["allowAdopt"] = allowAdopt
Expand Down
2 changes: 1 addition & 1 deletion routers/web/user/setting/applications.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const (

// Applications render manage access token page
func Applications(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.applications")
ctx.Data["PageIsSettingsApplications"] = true

loadApplicationsData(ctx)
Expand Down
2 changes: 1 addition & 1 deletion routers/web/user/setting/keys.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const (

// Keys render user's SSH/GPG public keys page
func Keys(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
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
Expand Down
8 changes: 4 additions & 4 deletions routers/web/user/setting/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const (

// Profile render user's profile page
func Profile(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.profile")
ctx.Data["PageIsSettingsProfile"] = true
ctx.Data["AllowedUserVisibilityModes"] = setting.Service.AllowedUserVisibilityModesSlice.ToVisibleTypeSlice()

Expand Down Expand Up @@ -220,7 +220,7 @@ func DeleteAvatar(ctx *context.Context) {

// Organization render all the organization of the user
func Organization(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.organization")
ctx.Data["PageIsSettingsOrganization"] = true

opts := organization.FindOrgOptions{
Expand Down Expand Up @@ -255,7 +255,7 @@ func Organization(ctx *context.Context) {

// Repos display a list of all repositories of the user
func Repos(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.repos")
ctx.Data["PageIsSettingsRepos"] = true
ctx.Data["allowAdopt"] = ctx.IsUserSiteAdmin() || setting.Repository.AllowAdoptionOfUnadoptedRepositories
ctx.Data["allowDelete"] = ctx.IsUserSiteAdmin() || setting.Repository.AllowDeleteOfUnadoptedRepositories
Expand Down Expand Up @@ -361,7 +361,7 @@ func Repos(ctx *context.Context) {

// Appearance render user's appearance settings
func Appearance(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.appearance")
ctx.Data["PageIsSettingsAppearance"] = true

var hiddenCommentTypes *big.Int
Expand Down
2 changes: 1 addition & 1 deletion routers/web/user/setting/security/security.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const (

// Security render change user's password page and 2FA
func Security(ctx *context.Context) {
ctx.Data["Title"] = ctx.Tr("settings")
ctx.Data["Title"] = ctx.Tr("settings.security")
ctx.Data["PageIsSettingsSecurity"] = true

if ctx.FormString("openid.return_to") != "" {
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/applications/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin config">
<div role="main" aria-label="{{.Title}}" class="page-content admin config">
{{template "admin/navbar" .}}
<div class="ui container">
<div class="twelve wide column content">
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/applications/oauth2_edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin config">
<div role="main" aria-label="{{.Title}}" class="page-content admin config">
{{template "admin/navbar" .}}

{{template "user/settings/applications_oauth2_edit_form" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/auth/edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin edit authentication">
<div role="main" aria-label="{{.Title}}" class="page-content admin edit authentication">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/auth/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin authentication">
<div role="main" aria-label="{{.Title}}" class="page-content admin authentication">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/auth/new.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin new authentication">
<div role="main" aria-label="{{.Title}}" class="page-content admin new authentication">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/config.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin config">
<div role="main" aria-label="{{.Title}}" class="page-content admin config">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/dashboard.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin dashboard">
<div role="main" aria-label="{{.Title}}" class="page-content admin dashboard">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/emails/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/hook_new.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin settings new webhook">
<div role="main" aria-label="{{.Title}}" class="page-content admin settings new webhook">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/hooks.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin hooks">
<div role="main" aria-label="{{.Title}}" class="page-content admin hooks">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/monitor.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin monitor">
<div role="main" aria-label="{{.Title}}" class="page-content admin monitor">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/notice.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin notice">
<div role="main" aria-label="{{.Title}}" class="page-content admin notice">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/org/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/packages/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/queue.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin monitor">
<div role="main" aria-label="{{.Title}}" class="page-content admin monitor">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/repo/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/repo/unadopted.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/stacktrace.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin monitor">
<div role="main" aria-label="{{.Title}}" class="page-content admin monitor">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/user/edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin edit user">
<div role="main" aria-label="{{.Title}}" class="page-content admin edit user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/user/list.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin user">
<div role="main" aria-label="{{.Title}}" class="page-content admin user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/admin/user/new.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content admin new user">
<div role="main" aria-label="{{.Title}}" class="page-content admin new user">
{{template "admin/navbar" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/code.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content explore users">
<div role="main" aria-label="{{.Title}}" class="page-content explore users">
{{template "explore/navbar" .}}
<div class="ui container">
{{template "code/searchform" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/organizations.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content explore users">
<div role="main" aria-label="{{.Title}}" class="page-content explore users">
{{template "explore/navbar" .}}
<div class="ui container">
{{template "explore/search" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/repos.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content explore repositories">
<div role="main" aria-label="{{.Title}}" class="page-content explore repositories">
{{template "explore/navbar" .}}
<div class="ui container">
{{template "explore/repo_search" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/explore/users.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content explore users">
<div role="main" aria-label="{{.Title}}" class="page-content explore users">
{{template "explore/navbar" .}}
<div class="ui container">
{{template "explore/search" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/home.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content home">
<div role="main" aria-label="{{if .IsSigned}}{{.locale.Tr "dashboard"}}{{else}}{{.locale.Tr "home"}}{{end}}" class="page-content home">
<div class="ui stackable middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<div>
Expand Down
2 changes: 1 addition & 1 deletion templates/install.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content install">
<div role="main" aria-label="{{.Title}}" class="page-content install">
<div class="ui middle very relaxed page grid">
<div class="sixteen wide center aligned centered column">
<h3 class="ui top attached header">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/create.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization new org">
<div role="main" aria-label="{{.Title}}" class="page-content organization new org">
<div class="ui middle very relaxed page grid">
<div class="column">
<form class="ui form" action="{{.Link}}" method="post">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/home.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization profile">
<div role="main" aria-label="{{.Title}}" class="page-content organization profile">
<div class="ui container df">
{{avatar .Org 140 "org-avatar"}}
<div id="org-info">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/member/members.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization members">
<div role="main" aria-label="{{.Title}}" class="page-content organization members">
{{template "org/header" .}}
<div class="ui container">
{{template "base/alert" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/applications.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings options">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings options">
{{template "org/header" .}}
<div class="ui container">
<div class="ui grid">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/applications_oauth2_edit.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings options">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings options">
{{template "org/header" .}}

{{template "user/settings/applications_oauth2_edit_form" .}}
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/delete.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings delete">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings delete">
{{template "org/header" .}}
<div class="ui container">
<div class="ui grid">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/hook_new.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings new webhook">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings new webhook">
{{template "org/header" .}}
<div class="ui container">
<div class="ui grid">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/hooks.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings webhooks">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings webhooks">
{{template "org/header" .}}
<div class="ui container">
<div class="ui grid">
Expand Down
2 changes: 1 addition & 1 deletion templates/org/settings/labels.tmpl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{template "base/head" .}}
<div class="page-content organization settings labels">
<div role="main" aria-label="{{.Title}}" class="page-content organization settings labels">
{{template "org/header" .}}
<div class="ui container">
<div class="ui grid">
Expand Down
Loading

0 comments on commit fb45bf2

Please sign in to comment.