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.table' &&
|
||||||
this.$route.name !== 'list.kanban'
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -71,6 +71,11 @@
|
||||||
flatPickr,
|
flatPickr,
|
||||||
GanttChart
|
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() {
|
data() {
|
||||||
return {
|
return {
|
||||||
showTaskswithoutDates: false,
|
showTaskswithoutDates: false,
|
||||||
|
|
|
@ -237,6 +237,13 @@
|
||||||
this.taskService = new TaskService()
|
this.taskService = new TaskService()
|
||||||
this.loadBuckets()
|
this.loadBuckets()
|
||||||
setTimeout(() => document.addEventListener('click', this.closeBucketDropdowns), 0)
|
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({
|
computed: mapState({
|
||||||
buckets: state => state.kanban.buckets,
|
buckets: state => state.kanban.buckets,
|
||||||
|
|
|
@ -136,6 +136,10 @@
|
||||||
},
|
},
|
||||||
created() {
|
created() {
|
||||||
this.taskService = new TaskService()
|
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: {
|
methods: {
|
||||||
// This function initializes the tasks page and loads the first page of tasks
|
// This function initializes the tasks page and loads the first page of tasks
|
||||||
|
|
|
@ -202,6 +202,10 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
this.initTasks(1)
|
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: {
|
methods: {
|
||||||
initTasks(page, search = '') {
|
initTasks(page, search = '') {
|
||||||
|
|
Loading…
Reference in a new issue