From 55a4a98b4da930b2360404c516ae41ee6448a171 Mon Sep 17 00:00:00 2001 From: Arthur Lefebvre Date: Sun, 12 Apr 2026 15:46:23 +0200 Subject: [PATCH] Collection book list: allow to directly input a position --- front/src/CollectionForm.vue | 7 ++- front/src/CollectionFormElement.vue | 57 ++++++++++++++++++- .../post_collection_changeposition_test.go | 1 + .../routes/collectionchangepositionpost.go | 10 ++-- 4 files changed, 67 insertions(+), 8 deletions(-) diff --git a/front/src/CollectionForm.vue b/front/src/CollectionForm.vue index 9073195..53607ec 100644 --- a/front/src/CollectionForm.vue +++ b/front/src/CollectionForm.vue @@ -58,7 +58,11 @@ function onDrop(id, position) { //nothing to do return } - postCollectionChangePosition(props.id, itemIdBeingGrabbed.value, position).then((res) => { + changePosition(itemIdBeingGrabbed.value, position) +} + +function changePosition(id, position) { + postCollectionChangePosition(props.id, id, position).then((res) => { if (res.ok) { getCollection(data, error, props.id, limit, offset.value) } else { @@ -87,6 +91,7 @@ function onDragend() { @dragend="onDragend" @dragover="onDragover" @dragenter="itemIdBeingOvered = item.id" + @positionchange="(pos) => changePosition(item.id, pos)" v-for="item in data.items" :key="item.id" :is-dragover="itemIdBeingOvered === item.id" diff --git a/front/src/CollectionFormElement.vue b/front/src/CollectionFormElement.vue index 86c0aa8..3d594af 100644 --- a/front/src/CollectionFormElement.vue +++ b/front/src/CollectionFormElement.vue @@ -1,4 +1,5 @@