From e70b6bfb998a822b18f3e90b8a4de1d5a2e4f51e Mon Sep 17 00:00:00 2001 From: Thomas Hackl <hackl@data-quest.de> Date: Tue, 2 May 2023 14:42:13 +0000 Subject: [PATCH] =?UTF-8?q?Resolve=20"Fehlermeldung=20TypeError:=20this.in?= =?UTF-8?q?itialNavigation=20is=20null=20auf=20Seiten,=20die=20sich=20nich?= =?UTF-8?q?t=20in=20die=20Navigation=20einh=C3=A4ngen"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #2435 Merge request studip/studip!1627 --- .../components/responsive/NavigationItem.vue | 30 ++++++++++++------- .../responsive/ResponsiveContentBar.vue | 4 +-- .../responsive/ResponsiveNavigation.vue | 8 +++-- 3 files changed, 26 insertions(+), 16 deletions(-) diff --git a/resources/vue/components/responsive/NavigationItem.vue b/resources/vue/components/responsive/NavigationItem.vue index c227771648c..0d164c233bf 100644 --- a/resources/vue/components/responsive/NavigationItem.vue +++ b/resources/vue/components/responsive/NavigationItem.vue @@ -5,26 +5,34 @@ <a :href="item.url" :title="navigateToText(item.title)" :aria-label="navigateToText(item.title)" tabindex="0"> <span class="navigation-icon"> - <studip-icon v-if="isCourse" shape="seminar" role="info_alt" size="24" alt=""></studip-icon> - <img v-if="item.icon" :src="iconUrl" width="24" alt=""> + <studip-icon v-if="isCourse" shape="seminar" role="info_alt" :size="24" alt=""></studip-icon> + <img v-if="item.icon" :src="iconUrl" width="24" alt="" /> </span> <span class="navigation-text"> {{ item.title }} </span> </a> </div> - <button class="styleless navigation-in" - :title="openNavigationText(item.title)" - :aria-label="openNavigationText(item.title)" - @click="moveTo(item.path)" @keydown.prevent.enter="moveTo(item.path)" @keydown.prevent.space="moveTo(item.path)"> - <studip-icon shape="arr_1right" role="info_alt" size="20" alt=""></studip-icon> + <button + class="styleless navigation-in" + :title="openNavigationText(item.title)" + :aria-label="openNavigationText(item.title)" + @click="moveTo(item.path)" + @keydown.prevent.enter="moveTo(item.path)" + @keydown.prevent.space="moveTo(item.path)" + > + <studip-icon shape="arr_1right" role="info_alt" :size="20" alt=""></studip-icon> </button> </template> <div v-else class="navigation-title"> - <a :href="item.url" tabindex="0" :title="navigateToText(item.title)" - :aria-label="navigateToText(item.title)"> - <studip-icon v-if="isCourse" shape="seminar" role="info_alt" size="24" alt=""></studip-icon> - <img v-if="item.icon" :src="iconUrl" width="24" alt=""> + <a + :href="item.url" + tabindex="0" + :title="navigateToText(item.title)" + :aria-label="navigateToText(item.title)" + > + <studip-icon v-if="isCourse" shape="seminar" role="info_alt" :size="24" alt=""></studip-icon> + <img v-if="item.icon" :src="iconUrl" width="24" alt="" /> {{ item.title }} </a> </div> diff --git a/resources/vue/components/responsive/ResponsiveContentBar.vue b/resources/vue/components/responsive/ResponsiveContentBar.vue index 0622bf64e9b..b40bdd8bb40 100644 --- a/resources/vue/components/responsive/ResponsiveContentBar.vue +++ b/resources/vue/components/responsive/ResponsiveContentBar.vue @@ -8,12 +8,12 @@ <div v-if="hasSidebar" class="contentbar-nav" ref="leftNav"> <button :class="sidebarIconClasses" @click.prevent="toggleSidebar" id="toggle-sidebar" :title="$gettext('Sidebar öffnen')"> - <studip-icon shape="sidebar3" size="24" ref="sidebarIcon" + <studip-icon shape="sidebar3" :size="24" ref="sidebarIcon" alt=""></studip-icon> </button> </div> <div class="contentbar-wrapper-left"> - <studip-icon :shape="icon" size="24" role="info" class="text-bottom contentbar-icon"></studip-icon> + <studip-icon :shape="icon" :size="24" role="info" class="text-bottom contentbar-icon"></studip-icon> <nav class="contentbar-breadcrumb" ref="breadcrumbs"> <span>{{ title }}</span> </nav> diff --git a/resources/vue/components/responsive/ResponsiveNavigation.vue b/resources/vue/components/responsive/ResponsiveNavigation.vue index 81b6a4da352..4151884b290 100644 --- a/resources/vue/components/responsive/ResponsiveNavigation.vue +++ b/resources/vue/components/responsive/ResponsiveNavigation.vue @@ -150,7 +150,8 @@ export default { iconSize: 28, showMenu: false, activeItem: this.navigation.activated.at(-1) ?? 'start', - currentNavigation: this.findItem(this.navigation.activated.at(0) ?? 'start', studipNavigation), + currentNavigation: this.findItem(this.navigation.activated.at(0) ?? 'start', studipNavigation) + ?? this.studipNavigation, initialNavigation: {}, initialTitle: '', isAdmin: ['root','admin'].includes(this.me.perm), @@ -259,7 +260,7 @@ export default { return found; } - // No children left to search through, we are doomed. + // No children left to search through, we are doomed. } else { return null; } @@ -345,7 +346,8 @@ export default { */ moveTo(path) { this.avatarMenuOpen = false; - this.currentNavigation = this.findItem(path ? path : '/', this.studipNavigation); + this.currentNavigation = + this.findItem(path ? path : '/', this.studipNavigation) ?? this.studipNavigation; this.$nextTick(() => { const current = document.querySelector('.navigation-current') ? document.querySelector('.navigation-current .navigation-title button') -- GitLab