Add HTMX endpoint for truncating series images and corresponding result template
This commit is contained in:
@@ -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 %}
|
||||
@@ -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")
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user