Restore staged uploads after page reload
This commit is contained in:
+12
-1
@@ -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 %}
|
||||
|
||||
Reference in New Issue
Block a user