Fix moving tasks between buckets
This commit is contained in:
parent
d9575ed11b
commit
110e2aaf37
@ -111,10 +111,11 @@
|
||||
<draggable
|
||||
v-model="bucket.tasks"
|
||||
@start="() => drag = true"
|
||||
@end="e => updateTaskPosition(k, e)"
|
||||
@end="updateTaskPosition"
|
||||
:group="{name: 'buckets', put: shouldAcceptDrop(bucket)}"
|
||||
v-bind="dragOptions"
|
||||
:disabled="!canWrite"
|
||||
:data-bucket-index="k"
|
||||
>
|
||||
<transition-group type="transition" :name="!drag ? 'move-card': null">
|
||||
<kanban-card
|
||||
@ -332,9 +333,14 @@ export default {
|
||||
this.error(e)
|
||||
})
|
||||
},
|
||||
updateTaskPosition(bucketIndex, e) {
|
||||
updateTaskPosition(e) {
|
||||
this.drag = false
|
||||
|
||||
// While we could just pass the bucket index in through the function call, this would not give us the
|
||||
// new bucket id when a task has been moved between buckets, only the new bucket. Using the data-bucket-id
|
||||
// of the drop target works all the time.
|
||||
const bucketIndex = parseInt(e.to.parentNode.dataset.bucketIndex)
|
||||
|
||||
const newBucket = this.buckets[bucketIndex]
|
||||
const task = newBucket.tasks[e.newIndex]
|
||||
const taskBefore = newBucket.tasks[e.newIndex - 1] ?? null
|
||||
|
Reference in New Issue
Block a user