From 51155f2fd23f7183a9d954eb162888da0d9d9063 Mon Sep 17 00:00:00 2001 From: Priec Date: Mon, 22 Jun 2026 19:03:33 +0200 Subject: [PATCH] I can move the images around now --- assets/views/admin/catalog/product_form.html | 73 +++++++++++--------- src/controllers/admin_form.rs | 35 +++++++--- src/controllers/admin_products.rs | 71 +++++++++++-------- 3 files changed, 106 insertions(+), 73 deletions(-) diff --git a/assets/views/admin/catalog/product_form.html b/assets/views/admin/catalog/product_form.html index 3eeae61..bd02266 100644 --- a/assets/views/admin/catalog/product_form.html +++ b/assets/views/admin/catalog/product_form.html @@ -127,62 +127,71 @@ {# --- Images gallery ------------------------------------------------------- #} - {# Existing images are reorderable (drag) and removable; the kept set is #} - {# submitted in order as repeated `existing_images` ids. New uploads accumulate #} - {# across separate "Add images" clicks into a DataTransfer that backs the hidden #} - {# `image` input (a native file input would otherwise replace its selection on #} - {# every pick); the controller stores and appends them after the kept images. #} + {# Unified drag-orderable gallery: existing images (with id) and new uploads #} + {# (placeholder blobs) live in a single list. The full order is submitted as #} + {# repeated `image_order` fields — an integer id for kept images or `new` for #} + {# each uploaded file. The DataTransfer backing the hidden `image` file input #} + {# is rebuilt after every reorder / add / remove so the file-part order matches #} + {# the relative order of `new` slots in `image_order`. #}
{{ t(key="images", lang=lang | default(value='sk')) }}

{{ t(key="gallery-hint", lang=lang | default(value='sk')) }}

-
-