Skip to content
Snippets Groups Projects
Commit c043ae23 authored by Moritz Strohm's avatar Moritz Strohm
Browse files

display skip links for first and second navigagion layer only when there are elements, fixes #4049

Closes #4049

Merge request studip/studip!2949


(cherry picked from commit cc617253)

233694ef display skip links for first and second navigagion layer only when there are elements
5da6f576 fixed third navigation layer on the start page
parent 10a1f49d
No related branches found
No related tags found
No related merge requests found
...@@ -57,6 +57,7 @@ class StartController extends AuthenticatedController ...@@ -57,6 +57,7 @@ class StartController extends AuthenticatedController
$nav = $sidebar->addWidget(new NavigationWidget()); $nav = $sidebar->addWidget(new NavigationWidget());
$nav->setTitle(_('Sprungmarken')); $nav->setTitle(_('Sprungmarken'));
$nav->setId('navigation-layer-3');
foreach (array_merge(...$this->columns) as $widget) { foreach (array_merge(...$this->columns) as $widget) {
$nav->addLink( $nav->addLink(
$widget->getPluginName(), $widget->getPluginName(),
......
...@@ -222,7 +222,7 @@ class Sidebar extends WidgetContainer ...@@ -222,7 +222,7 @@ class Sidebar extends WidgetContainer
static $actions_widget_added = false; static $actions_widget_added = false;
if ($widget instanceof NavigationWidget && !$navigation_widget_added) { if ($widget instanceof NavigationWidget && !$navigation_widget_added && $widget->hasElements()) {
SkipLinks::addIndex( SkipLinks::addIndex(
_('Dritte Navigationsebene'), _('Dritte Navigationsebene'),
$widget->getId(), $widget->getId(),
...@@ -233,7 +233,7 @@ class Sidebar extends WidgetContainer ...@@ -233,7 +233,7 @@ class Sidebar extends WidgetContainer
$navigation_widget_added = true; $navigation_widget_added = true;
} }
if ($widget instanceof ActionsWidget && !$actions_widget_added) { if ($widget instanceof ActionsWidget && !$actions_widget_added && $widget->hasElements()) {
if (!$widget->getId()) { if (!$widget->getId()) {
$widget->setId('sidebar-actions'); $widget->setId('sidebar-actions');
} }
......
...@@ -216,7 +216,9 @@ if ($navigation) { ...@@ -216,7 +216,9 @@ if ($navigation) {
<!-- Main navigation and right-hand logo --> <!-- Main navigation and right-hand logo -->
<nav id="navigation-level-1" aria-label="<?= _('Hauptnavigation') ?>"> <nav id="navigation-level-1" aria-label="<?= _('Hauptnavigation') ?>">
<? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false); ?> <? if (!empty($header_nav['visible'])) : ?>
<? SkipLinks::addIndex(_('Hauptnavigation'), 'navigation-level-1', 2, false) ?>
<? endif ?>
<ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>> <ul id="navigation-level-1-items" <? if (count($header_nav['hidden']) > 0) echo 'class="overflown"'; ?>>
<? foreach ($header_nav['visible'] as $path => $nav): ?> <? foreach ($header_nav['visible'] as $path => $nav): ?>
<?= $this->render_partial( <?= $this->render_partial(
...@@ -297,10 +299,12 @@ if ($navigation) { ...@@ -297,10 +299,12 @@ if ($navigation) {
</div> </div>
<? endif ?> <? endif ?>
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?>
<nav id="navigation-level-2" aria-label="<?= _('Zweite Navigationsebene') ?>"> <nav id="navigation-level-2" aria-label="<?= _('Zweite Navigationsebene') ?>">
<? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?> <? if (PageLayout::isHeaderEnabled() /*&& isset($navigation)*/) : ?>
<? if (!empty($navigation)) : ?>
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 910) ?>
<? endif ?>
<?= $this->render_partial('tabs', compact('navigation')) ?> <?= $this->render_partial('tabs', compact('navigation')) ?>
<? endif; ?> <? endif; ?>
</nav> </nav>
......
...@@ -7,10 +7,10 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) { ...@@ -7,10 +7,10 @@ foreach (Navigation::getItem("/")->getSubNavigation() as $path => $nav) {
} }
?> ?>
<div class="tabs_wrapper"> <div class="tabs_wrapper">
<? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?>
<ul id="tabs"> <ul id="tabs">
<? if (!empty($navigation)): ?> <? if (!empty($navigation)): ?>
<? foreach ($navigation as $path => $nav) : ?> <? SkipLinks::addIndex(_('Zweite Navigationsebene'), 'navigation-level-2', 10, false); ?>
<? foreach ($navigation as $path => $nav) : ?>
<? if ($nav->isVisible()) : ?> <? if ($nav->isVisible()) : ?>
<li id="nav_<?= $path1 ?? '' ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>> <li id="nav_<?= $path1 ?? '' ?>_<?= $path ?>"<?= $nav->isActive() ? ' class="current"' : '' ?>>
<? if ($nav->isEnabled()): ?> <? if ($nav->isEnabled()): ?>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment