Add delete button on the enemy detail page

CSRF-protected POST to /enemies/{id}/delete with a confirm. Any
combatants referencing the enemy keep their snapshotted stats (the FK
sets enemy_id null), so deleting a monster type won't disturb a fight.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Frank
2026-09-06 21:39:12 +02:00
co-authored by Claude Sonnet 5
parent 684cbf3b4f
commit bc42adcad9
2 changed files with 22 additions and 1 deletions
+8 -1
View File
@@ -11,7 +11,14 @@
<h1 class="h3 mb-0">{{ enemy.name }}</h1>
<span class="text-body-secondary fst-italic">{{ enemy.metaLine }}</span>
</div>
<a href="{{ path('app_enemies_edit', {id: enemy.id}) }}" class="btn btn-outline-secondary btn-sm">Edit stats</a>
<div class="d-flex gap-2">
<a href="{{ path('app_enemies_edit', {id: enemy.id}) }}" class="btn btn-outline-secondary btn-sm">Edit stats</a>
<form method="post" action="{{ path('app_enemies_delete', {id: enemy.id}) }}"
onsubmit="return confirm('Delete “{{ enemy.name|e('js') }}” from the enemy list?')">
<input type="hidden" name="_token" value="{{ csrf_token('delete-enemy-' ~ enemy.id) }}">
<button class="btn btn-outline-danger btn-sm">Delete</button>
</form>
</div>
</div>
<div class="row g-4">