Remember list view when navigating between lists
This commit is contained in:
parent
978e7b4acb
commit
12727900de
5 changed files with 24 additions and 1 deletions
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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 = '') {
|
||||
|
|
Loading…
Reference in a new issue