Add making tasks favorite from the task detail view

This commit is contained in:
kolaente 2021-07-28 22:13:24 +02:00
parent ccf466c31c
commit 617a6a0c21
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B
2 changed files with 21 additions and 1 deletions

View file

@ -512,7 +512,9 @@
"relatedTasks": "Add task relations",
"moveList": "Move task",
"color": "Set task color",
"delete": "Delete task"
"delete": "Delete task",
"favorite": "Make this task as a favorite",
"unfavorite": "Don't make this task a favorite"
}
},
"attributes": {

View file

@ -361,6 +361,13 @@
>
{{ $t('task.detail.actions.color') }}
</x-button>
<x-button
@click="toggleFavorite"
type="secondary"
:icon="task.isFavorite ? ['far', 'star'] : 'star'"
>
{{ task.isFavorite ? $t('task.detail.actions.favorite') : $t('task.detail.actions.unfavorite') }}
</x-button>
<x-button
@click="showDeleteModal = true"
icon="trash-alt"
@ -682,6 +689,17 @@ export default {
this.saveTask()
this.$store.commit('kanban/removeTaskInBucket', this.task)
},
toggleFavorite() {
this.task.isFavorite = !this.task.isFavorite
this.taskService.update(this.task)
.then(t => {
this.task = t
this.$store.dispatch('namespaces/loadNamespacesIfFavoritesDontExist')
})
.catch(e => {
this.error(e)
})
},
},
}
</script>