Mark tasks as done from the kanban board with ctrl+click

This commit is contained in:
kolaente 2020-07-05 21:29:14 +02:00
parent 7346ded459
commit d43427623c
No known key found for this signature in database
GPG key ID: F40E70337AB24C9B

View file

@ -41,16 +41,17 @@
drag-handle-selector=".task.draggable" drag-handle-selector=".task.draggable"
> >
<Draggable v-for="task in bucket.tasks" :key="`bucket${bucket.id}-task${task.id}`"> <Draggable v-for="task in bucket.tasks" :key="`bucket${bucket.id}-task${task.id}`">
<router-link <div
:to="{ name: 'task.kanban.detail', params: { id: task.id } }"
class="task loader-container draggable" class="task loader-container draggable"
tag="div"
:class="{ :class="{
'is-loading': taskService.loading && taskUpdating[task.id], 'is-loading': taskService.loading && taskUpdating[task.id],
'draggable': !taskService.loading || !taskUpdating[task.id], 'draggable': !taskService.loading || !taskUpdating[task.id],
'has-light-text': !colorIsDark(task.hexColor) && task.hexColor !== `#${task.defaultColor}`, 'has-light-text': !colorIsDark(task.hexColor) && task.hexColor !== `#${task.defaultColor}`,
}" }"
:style="{'background-color': task.hexColor !== '#' && task.hexColor !== `#${task.defaultColor}` ? task.hexColor : false}" :style="{'background-color': task.hexColor !== '#' && task.hexColor !== `#${task.defaultColor}` ? task.hexColor : false}"
@click.ctrl="() => markTaskAsDone(task)"
@click.meta="() => markTaskAsDone(task)"
@click.exact="() => $router.push({ name: 'task.kanban.detail', params: { id: task.id } })"
> >
<span class="task-id"> <span class="task-id">
<span class="is-done" v-if="task.done">Done</span> <span class="is-done" v-if="task.done">Done</span>
@ -100,7 +101,7 @@
</span> </span>
</div> </div>
</div> </div>
</router-link> </div>
</Draggable> </Draggable>
</Container> </Container>
</div> </div>
@ -329,6 +330,16 @@
}) })
} }
}, },
markTaskAsDone(task) {
task.done = !task.done
this.$store.dispatch('tasks/update', task)
.catch(e => {
this.error(e, this)
})
.finally(() => {
this.$set(this.taskUpdating, task.id, false)
})
},
getTaskPayload(bucketId) { getTaskPayload(bucketId) {
return index => { return index => {
const bucket = this.buckets[filterObject(this.buckets, b => b.id === bucketId)] const bucket = this.buckets[filterObject(this.buckets, b => b.id === bucketId)]