Restore staged uploads after page reload

This commit is contained in:
Krikorios
2026-05-07 18:53:40 +03:00
parent 68d13dbf57
commit 631a4c3e3d
2 changed files with 38 additions and 1 deletions
+12 -1
View File
@@ -124,7 +124,7 @@
{% block scripts %}
<script>
// ─── Unified staging workflow ─────────────────────────────────
const stagedItems = []; // {id, image_path, name}
const stagedItems = {{ staged_documents|tojson }}; // {id, image_path, name}
let uploading = false;
const cameraInput = document.getElementById('cameraInput');
@@ -209,6 +209,14 @@ function finishThumb(thumb, item) {
`;
}
function renderExistingStaged() {
gallery.innerHTML = '';
for (const item of stagedItems) {
const thumb = addPlaceholder(item.name);
finishThumb(thumb, item);
}
}
async function removeStagedItem(id, btn) {
const thumb = btn.closest('.staging-thumb');
thumb.classList.add('removing');
@@ -266,5 +274,8 @@ async function clearStaged() {
gallery.innerHTML = '';
refreshUI();
}
renderExistingStaged();
refreshUI();
</script>
{% endblock %}