Remember list view when navigating between lists
continuous-integration/drone/push Build is passing Details

This commit is contained in:
kolaente 2020-05-21 11:12:59 +02:00
parent 978e7b4acb
commit 12727900de
Signed by: konrad
GPG Key ID: F40E70337AB24C9B
5 changed files with 24 additions and 1 deletions

View File

@ -68,7 +68,10 @@
this.$route.name !== 'list.table' &&
this.$route.name !== 'list.kanban'
) {
router.replace({name: 'list.list', params: {id: this.$route.params.listId}})
const savedListView = localStorage.getItem('listView')
router.replace({name: savedListView ? savedListView : 'list.list', params: {id: this.$route.params.listId}})
return
}

View File

@ -71,6 +71,11 @@
flatPickr,
GanttChart
},
created() {
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
localStorage.setItem('listView', this.$route.name)
},
data() {
return {
showTaskswithoutDates: false,

View File

@ -237,6 +237,13 @@
this.taskService = new TaskService()
this.loadBuckets()
setTimeout(() => document.addEventListener('click', this.closeBucketDropdowns), 0)
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
localStorage.setItem('listView', this.$route.name)
},
watch: {
'$route.params.listId': 'loadBuckets',
},
computed: mapState({
buckets: state => state.kanban.buckets,

View File

@ -136,6 +136,10 @@
},
created() {
this.taskService = new TaskService()
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
localStorage.setItem('listView', this.$route.name)
},
methods: {
// This function initializes the tasks page and loads the first page of tasks

View File

@ -202,6 +202,10 @@
}
this.initTasks(1)
// Save the current list view to local storage
// We use local storage and not vuex here to make it persistent across reloads.
localStorage.setItem('listView', this.$route.name)
},
methods: {
initTasks(page, search = '') {