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>
<div :class="{ 'is-loading': taskService.loading}" class="loader-container task-view-container">
<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">
{{ parent.namespace.title }} >
<router-link :to="{ name: listViewName, params: { listId: parent.list.id } }">
@ -499,6 +499,12 @@ export default {
.catch(e => {
this.error(e, this)
})
.finally(() => {
this.scrollToHeading()
})
},
scrollToHeading() {
this.$refs.heading.$el.scrollIntoView({block: 'center'})
},
setActiveFields() {

View file

@ -29,6 +29,14 @@ export default {
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: {
close() {
if (this.lastRoute === null) {