From 369864e36c2046d4a880da3ba3a608eaae0c4d5e Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Fri, 19 Jun 2020 15:38:17 +0100 Subject: [PATCH 1/4] Add logic for active page highlighting --- src/components/Page/Navigation.vue | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/components/Page/Navigation.vue b/src/components/Page/Navigation.vue index 92b2b9350..3f71e9c6b 100644 --- a/src/components/Page/Navigation.vue +++ b/src/components/Page/Navigation.vue @@ -18,7 +18,7 @@ v-for="(page, pageIndex) in pages" :key="pageIndex" class="moj-side-navigation__item" - :class="{'moj-side-navigation__item--active': page.on}" + :class="{'moj-side-navigation__item--active': isActive(page)}" > ['edit','list'].indexOf(i) !== -1)) { + // check the names match + return page.name.split('-')[2] == this.$route.name.split('-')[2]; + } + else { + return this.$route.name == page.name; + } + }, + }, + }; From 108c44457394509836bfed472406581c230dc3cf Mon Sep 17 00:00:00 2001 From: Tom Russell Date: Tue, 23 Jun 2020 16:09:32 +0100 Subject: [PATCH 2/4] Add active page highlighting for move back pages --- src/components/Page/Navigation.vue | 4 ++-- src/views/Exercises/Show.vue | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/components/Page/Navigation.vue b/src/components/Page/Navigation.vue index 3f71e9c6b..fb6fe2754 100644 --- a/src/components/Page/Navigation.vue +++ b/src/components/Page/Navigation.vue @@ -57,8 +57,8 @@ export default { // check the last word in the route path matches the page title (to lowercase) return this.$route.path.split('/')[this.$route.path.split('/').length-1] == page.title.toLowerCase(); } - // if the route is an edit or list page - else if (this.$route.name.split('-').some(i=>['edit','list'].indexOf(i) !== -1)) { + // if the route is an edit, list or back page + else if (this.$route.name.split('-').some(i=>['edit','list','back'].indexOf(i) !== -1)) { // check the names match return page.name.split('-')[2] == this.$route.name.split('-')[2]; } diff --git a/src/views/Exercises/Show.vue b/src/views/Exercises/Show.vue index 9b57d56a3..c2c0bb81d 100644 --- a/src/views/Exercises/Show.vue +++ b/src/views/Exercises/Show.vue @@ -42,10 +42,10 @@