Browse Source

Merge pull request #35609 from nextcloud/add-data-section-id

Add section-id and section-type data attributes to settings <li> navigation items
pull/34491/head
Vincent Petry 3 years ago
committed by GitHub
parent
commit
d33f707bfd
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 1
      apps/settings/lib/Controller/CommonSettingsTrait.php
  2. 7
      apps/settings/templates/settings/frame.php

1
apps/settings/lib/Controller/CommonSettingsTrait.php

@ -150,6 +150,7 @@ trait CommonSettingsTrait {
$activeSection = $this->settingsManager->getSection($type, $section);
if ($activeSection) {
$templateParams['pageTitle'] = $activeSection->getName();
$templateParams['activeSectionId'] = $activeSection->getID();
}
return new TemplateResponse('settings', 'settings/frame', $templateParams);

7
apps/settings/templates/settings/frame.php

@ -40,7 +40,7 @@ script('files', 'jquery.fileupload');
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.PersonalSettings.index', ['section' => $form['anchor']]);
$class = 'nav-icon-' . $form['anchor'];
$sectionName = $form['section-name']; ?>
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="personal">
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
<?php if (!empty($form['icon'])) { ?>
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
@ -66,7 +66,7 @@ script('files', 'jquery.fileupload');
$anchor = \OC::$server->getURLGenerator()->linkToRoute('settings.AdminSettings.index', ['section' => $form['anchor']]);
$class = 'nav-icon-' . $form['anchor'];
$sectionName = $form['section-name']; ?>
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?>>
<li <?php print_unescaped($form['active'] ? ' class="active"' : ''); ?> data-section-id="<?php print_unescaped($form['anchor']); ?>" data-section-type="admin">
<a href="<?php p($anchor); ?>"<?php print_unescaped($form['active'] ? ' aria-current="page"' : ''); ?>>
<?php if (!empty($form['icon'])) { ?>
<img alt="" src="<?php print_unescaped($form['icon']); ?>">
@ -82,7 +82,6 @@ script('files', 'jquery.fileupload');
?>
</ul>
</div>
<div id="app-content" tabindex="0">
<div id="app-content" tabindex="0" data-active-section-id="<?php print_unescaped($_['activeSectionId']) ?>">
<?php print_unescaped($_['content']); ?>
</div>
Loading…
Cancel
Save