Mercurial > gemma
changeset 1245:36e8470daba2
fix: Consistent main menu structure
We now have a consisten main menu structure.
There are always all entries available.
In case the user is in the "sysadmin context" and selects
a point regarding the map, he is routed back to "/" and
the according component is shown.
Otherwise the reselection of an entry acts as before
(toggling the visibility of said component).
author | Thomas Junk <thomas.junk@intevation.de> |
---|---|
date | Wed, 21 Nov 2018 11:15:23 +0100 |
parents | 162a790120c2 |
children | b41494821b02 |
files | client/src/application/Sidebar.vue |
diffstat | 1 files changed, 11 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/client/src/application/Sidebar.vue Wed Nov 21 10:48:34 2018 +0100 +++ b/client/src/application/Sidebar.vue Wed Nov 21 11:15:23 2018 +0100 @@ -12,23 +12,19 @@ <i class="fa fa-map-o align-self-center navicon"></i>Map </router-link> <div class="d-flex flex-row nav-link"> - <i v-if="routeName == 'mainview'" class="fa fa-ship align-self-center navicon"></i> + <i class="fa fa-ship align-self-center navicon"></i> <a class="text-body d-flex flex-row" - v-if="routeName == 'mainview'" href="#" @click="toggleContextBox('bottlenecks')" >Bottlenecks</a> </div> <div v-if="isSysAdmin"> <hr> - <div - v-if="routeName == 'mainview'" - class="nav-link d-flex menupadding text-muted" - >Administration</div> + <div class="nav-link d-flex menupadding text-muted">Administration</div> </div> <div v-if="isWaterwayAdmin"> - <div v-if="routeName == 'mainview'" class="d-flex flex-row nav-link"> + <div class="d-flex flex-row nav-link"> <i class="fa fa-upload align-self-center navicon"></i> <a href="#" @@ -36,7 +32,7 @@ @click="toggleContextBox('imports')" >Import soundingresults</a> </div> - <div v-if="routeName == 'mainview'" class="d-flex flex-row nav-link"> + <div class="d-flex flex-row nav-link"> <i class="fa fa-list-ol align-self-center navicon"></i> <a href="#" @@ -128,10 +124,13 @@ this.$router.push("/login"); }, toggleContextBox(context) { - this.$store.commit( - "application/showInContextBox", - this.showInContextBox === context ? null : context - ); + const SHOW = context; + const HIDE = null; + const isElementAlreadyShown = this.showInContextBox === context; + let toggleState = + isElementAlreadyShown && this.routeName === "mainview" ? HIDE : SHOW; + this.$router.push("/"); + this.$store.commit("application/showInContextBox", toggleState); if (this.showInContextBox === context) { this.$store.commit("application/showSearchbar", true); } else {