summaryrefslogtreecommitdiffstats
path: root/webapp/src/components/GroupModule.vue
diff options
context:
space:
mode:
authorUdo Walter2018-08-05 23:55:52 +0200
committerUdo Walter2018-08-05 23:55:52 +0200
commit53dd49f72acccb634b4cb4815d69cbfcc4d759ac (patch)
treed837c75901cce2c94e49908050f8ef1939717914 /webapp/src/components/GroupModule.vue
parentmerge (diff)
downloadbas-53dd49f72acccb634b4cb4815d69cbfcc4d759ac.tar.gz
bas-53dd49f72acccb634b4cb4815d69cbfcc4d759ac.tar.xz
bas-53dd49f72acccb634b4cb4815d69cbfcc4d759ac.zip
[webapp/groups] add browser back/forwared compatibility
Diffstat (limited to 'webapp/src/components/GroupModule.vue')
-rw-r--r--webapp/src/components/GroupModule.vue22
1 files changed, 17 insertions, 5 deletions
diff --git a/webapp/src/components/GroupModule.vue b/webapp/src/components/GroupModule.vue
index 5a13385..f873e68 100644
--- a/webapp/src/components/GroupModule.vue
+++ b/webapp/src/components/GroupModule.vue
@@ -68,10 +68,13 @@ export default {
},
watch: {
activeTab (index) {
- this.$router.replace({
- name: 'GroupModule.' + this.tabChain[index].tabType,
- params: { id: this.tabChain[index].id || 'create', noReload: true }
- })
+ const item = this.tabChain[index]
+ if (item.tabType !== this.$route.name.replace('GroupModule.', '') || String(item.id) !== String(this.$route.params.id)) {
+ this.$router.push({
+ name: 'GroupModule.' + item.tabType,
+ params: { id: (item.id || item.tabType === 'home') ? item.id : 'create', noReload: true }
+ })
+ }
}
},
methods: {
@@ -97,7 +100,16 @@ export default {
})
},
beforeRouteUpdate (to, from, next) {
- if (!to.params.noReload) this.loadItem(to.name, to.params.id)
+ const typeFromRoute = to.name.replace('GroupModule.', '')
+ var tabIndex
+ this.tabChain.some((item, index) => {
+ if (item.tabType === typeFromRoute && String(item.id) === String(to.params.id)) {
+ tabIndex = index
+ return true
+ } else { return false }
+ })
+ if (!to.params.noReload && tabIndex === undefined) this.loadItem(to.name, to.params.id)
+ else if (tabIndex !== undefined) this.setActiveTab(tabIndex)
next()
}
}