Add HTMX endpoint for truncating series images and corresponding result template

This commit is contained in:
Ross
2026-02-02 13:24:27 +00:00
parent 8911c09c0e
commit 5bb2aea8ef
4 changed files with 56 additions and 2 deletions
@@ -0,0 +1,10 @@
<div class="alert alert-success">
<strong>Truncate complete.</strong>
<div class="small mt-1">Removed {{ images_removed|length }} images from series {{ series.pk }}.</div>
</div>
{% if images_removed %}
<details class="mt-2">
<summary class="small">Show removed image IDs</summary>
<div class="small mt-1">{{ images_removed|join:", " }}</div>
</details>
{% endif %}
+4 -2
View File
@@ -251,8 +251,10 @@
return;
}
if(confirm(`Trucated series. This will leave ${upper_bound - lower_bound + 1} images.`) == true) {
htmx.ajax("GET", `{% url 'api-1:series_truncate' series.id '****' '++++' %}`.replace("****", lower_bound).replace("++++", upper_bound), "#truncate-output")
if(confirm(`Trucated series. This will leave ${upper_bound - lower_bound + 1} images.`) == true) {
const truncateTemplate = `{% url 'atlas:series_truncate' series.id 0 0 %}`; // e.g. /atlas/series/920/truncate/0/0/
const truncateUrl = truncateTemplate.replace('/0/0/', `/${lower_bound}/${upper_bound}/`);
htmx.ajax("GET", truncateUrl, "#truncate-output")
}