From: julia.kirschenheuter Date: Wed, 8 Feb 2023 14:40:41 +0000 (+0100) Subject: Create headings for settings pages X-Git-Tag: v27.0.0beta1~368^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=0cfbe54a5a391d3af6dd37902cda6b914f07480d;p=nextcloud-server.git Create headings for settings pages Signed-off-by: julia.kirschenheuter --- diff --git a/apps/settings/lib/Controller/AppSettingsController.php b/apps/settings/lib/Controller/AppSettingsController.php index a4addfc5b35..d0ed408df02 100644 --- a/apps/settings/lib/Controller/AppSettingsController.php +++ b/apps/settings/lib/Controller/AppSettingsController.php @@ -136,7 +136,7 @@ class AppSettingsController extends Controller { $params['bundles'] = $this->getBundles(); $this->navigationManager->setActiveEntry('core_apps'); - $templateResponse = new TemplateResponse('settings', 'settings-vue', ['serverData' => $params]); + $templateResponse = new TemplateResponse('settings', 'settings-vue', ['serverData' => $params, 'pageTitle' => $this->l10n->t('Apps')]); $policy = new ContentSecurityPolicy(); $policy->addAllowedImageDomain('https://usercontent.apps.nextcloud.com'); $templateResponse->setContentSecurityPolicy($policy); diff --git a/apps/settings/lib/Controller/UsersController.php b/apps/settings/lib/Controller/UsersController.php index 217abf0e156..89a850c1980 100644 --- a/apps/settings/lib/Controller/UsersController.php +++ b/apps/settings/lib/Controller/UsersController.php @@ -277,7 +277,7 @@ class UsersController extends Controller { $serverData['newUserRequireEmail'] = $this->config->getAppValue('core', 'newUser.requireEmail', 'no') === 'yes'; $serverData['newUserSendEmail'] = $this->config->getAppValue('core', 'newUser.sendEmail', 'yes') === 'yes'; - return new TemplateResponse('settings', 'settings-vue', ['serverData' => $serverData]); + return new TemplateResponse('settings', 'settings-vue', ['serverData' => $serverData, 'pageTitle' => $this->l10n->t('Users')]); } /** diff --git a/apps/settings/src/router.js b/apps/settings/src/router.js index 863bd49c32d..cf842475c5d 100644 --- a/apps/settings/src/router.js +++ b/apps/settings/src/router.js @@ -27,6 +27,7 @@ import Router from 'vue-router' import { generateUrl } from '@nextcloud/router' import { APPS_SECTION_ENUM } from './constants/AppsConstants.js' import store from './store/index.js' +import { setPageHeading } from '../../../core/src/OCP/accessibility.js' // Dynamic loading const Users = () => import(/* webpackChunkName: 'settings-users' */'./views/Users') @@ -126,6 +127,7 @@ router.afterEach(async (to) => { const metaTitle = await to.meta.title?.(to) if (metaTitle) { document.title = `${metaTitle} - ${baseTitle}` + setPageHeading(metaTitle) } else { document.title = baseTitle } diff --git a/apps/settings/tests/Controller/AppSettingsControllerTest.php b/apps/settings/tests/Controller/AppSettingsControllerTest.php index 28d77dc3696..8d0dae223d3 100644 --- a/apps/settings/tests/Controller/AppSettingsControllerTest.php +++ b/apps/settings/tests/Controller/AppSettingsControllerTest.php @@ -209,7 +209,8 @@ class AppSettingsControllerTest extends TestCase { 'appstoreEnabled' => true, 'bundles' => [], 'developerDocumentation' => '' - ] + ], + 'pageTitle' => 'Apps' ], 'user'); $expected->setContentSecurityPolicy($policy); @@ -243,7 +244,8 @@ class AppSettingsControllerTest extends TestCase { 'appstoreEnabled' => false, 'bundles' => [], 'developerDocumentation' => '' - ] + ], + 'pageTitle' => 'Apps' ], 'user'); $expected->setContentSecurityPolicy($policy); diff --git a/core/src/OCP/accessibility.js b/core/src/OCP/accessibility.js index 3839509228f..d318d3497c4 100644 --- a/core/src/OCP/accessibility.js +++ b/core/src/OCP/accessibility.js @@ -22,6 +22,18 @@ import { loadState } from '@nextcloud/initial-state' +/** + * Set the page heading + * + * @param {string} heading page title from the history api + * @since 27.0.0 + */ +export function setPageHeading(heading) { + const headingEl = document.getElementById('page-heading-level-1') + if (headingEl) { + headingEl.textContent = heading + } +} export default { /** * @return {boolean} Whether the user opted-out of shortcuts so that they should not be registered @@ -29,4 +41,5 @@ export default { disableKeyboardShortcuts() { return loadState('theming', 'shortcutsDisabled', false) }, + setPageHeading, } diff --git a/core/templates/layout.user.php b/core/templates/layout.user.php index dc38f642ca4..7c2625bbaaf 100644 --- a/core/templates/layout.user.php +++ b/core/templates/layout.user.php @@ -57,6 +57,9 @@ p($theme->getTitle());