Fix getting back to the default task view when navigating back from a task modal

This commit is contained in:
kolaente 2021-01-10 22:37:43 +01:00
parent d7112c99c7
commit eb31798f06
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 15 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<template> <template>
<div :class="{ 'is-loading': taskService.loading}" class="loader-container task-view-container"> <div :class="{ 'is-loading': taskService.loading}" class="loader-container task-view-container">
<div class="task-view"> <div class="task-view">
<heading v-model="task" :can-write="canWrite"/> <heading v-model="task" :can-write="canWrite" ref="heading"/>
<h6 class="subtitle" v-if="parent && parent.namespace && parent.list"> <h6 class="subtitle" v-if="parent && parent.namespace && parent.list">
{{ parent.namespace.title }} > {{ parent.namespace.title }} >
<router-link :to="{ name: listViewName, params: { listId: parent.list.id } }"> <router-link :to="{ name: listViewName, params: { listId: parent.list.id } }">
@ -499,6 +499,12 @@ export default {
.catch(e => { .catch(e => {
this.error(e, this) this.error(e, this)
}) })
.finally(() => {
this.scrollToHeading()
})
},
scrollToHeading() {
this.$refs.heading.$el.scrollIntoView({block: 'center'})
}, },
setActiveFields() { setActiveFields() {

View file

@ -29,6 +29,14 @@ export default {
vm.lastRoute = from vm.lastRoute = from
}) })
}, },
beforeRouteLeave(to, from, next) {
if (from.name === 'task.kanban.detail' && to.name === 'task.detail') {
this.$router.replace({name: 'task.kanban.detail', params: to.params})
return
}
next()
},
methods: { methods: {
close() { close() {
if (this.lastRoute === null) { if (this.lastRoute === null) {