show board name in browser title
Signed-off-by: Luka Trovic <luka@nextcloud.com>
This commit is contained in:
@@ -239,6 +239,7 @@ export default {
|
|||||||
isAddStackVisible: false,
|
isAddStackVisible: false,
|
||||||
filter: { tags: [], users: [], due: '', unassigned: false },
|
filter: { tags: [], users: [], due: '', unassigned: false },
|
||||||
showAddCardModal: false,
|
showAddCardModal: false,
|
||||||
|
defaultPageTitle: false,
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -266,11 +267,17 @@ export default {
|
|||||||
return [...this.board.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
|
return [...this.board.labels].sort((a, b) => (a.title < b.title) ? -1 : 1)
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
beforeDestroy() {
|
||||||
|
this.setPageTitle('')
|
||||||
|
},
|
||||||
watch: {
|
watch: {
|
||||||
board(current, previous) {
|
board(current, previous) {
|
||||||
if (current?.id !== previous?.id) {
|
if (current?.id !== previous?.id) {
|
||||||
this.clearFilter()
|
this.clearFilter()
|
||||||
}
|
}
|
||||||
|
if (current) {
|
||||||
|
this.setPageTitle(current.title)
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -330,6 +337,22 @@ export default {
|
|||||||
clickHideAddCardModel() {
|
clickHideAddCardModel() {
|
||||||
this.showAddCardModal = false
|
this.showAddCardModal = false
|
||||||
},
|
},
|
||||||
|
setPageTitle(title) {
|
||||||
|
if (this.defaultPageTitle === false) {
|
||||||
|
this.defaultPageTitle = window.document.title
|
||||||
|
if (this.defaultPageTitle.indexOf(' - Deck - ') !== -1) {
|
||||||
|
this.defaultPageTitle = this.defaultPageTitle.substring(this.defaultPageTitle.indexOf(' - Deck - ') + 3)
|
||||||
|
}
|
||||||
|
if (this.defaultPageTitle.indexOf('Deck - ') !== 0) {
|
||||||
|
this.defaultPageTitle = 'Deck - ' + this.defaultPageTitle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let newTitle = this.defaultPageTitle
|
||||||
|
if (title !== '') {
|
||||||
|
newTitle = `${title} - ${newTitle}`
|
||||||
|
}
|
||||||
|
window.document.title = newTitle
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
Reference in New Issue
Block a user