- Encounter entity; Combatant now belongs to an encounter (ON DELETE
CASCADE). Migration adds encounter_id, rehoming any existing combatants.
- /tracker lists encounters (name, count, last updated) with a "New
encounter" form; /tracker/{id} is the HP tracker for one encounter.
- Encounters can be renamed, have their combatants cleared, or be deleted.
- The Enemies list gains an encounter picker next to "Add to tracker"
(existing encounter or "— New encounter —", which prompts for a name);
an encounter's "Add enemies" link pre-selects it via ?encounter=.
- Routes for combatant HP/remove moved under /tracker/combatant/ to keep
the numeric {id} for encounters.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
40 lines
1.8 KiB
Twig
40 lines
1.8 KiB
Twig
{% extends 'base.html.twig' %}
|
|
|
|
{% block title %}Tracker · dmtools{% endblock %}
|
|
|
|
{% block body %}
|
|
<div class="d-flex justify-content-between align-items-center mb-3 gap-2 flex-wrap">
|
|
<h1 class="h3 mb-0">Encounters</h1>
|
|
<form method="post" action="{{ path('app_tracker_new') }}" class="d-flex gap-2">
|
|
<input type="hidden" name="_token" value="{{ csrf_token('tracker-new') }}">
|
|
<input type="text" name="name" class="form-control form-control-sm" style="width: 14rem;"
|
|
placeholder="New encounter name" aria-label="New encounter name">
|
|
<button class="btn btn-primary btn-sm text-nowrap">New encounter</button>
|
|
</form>
|
|
</div>
|
|
|
|
{% if not encounters %}
|
|
<div class="card shadow-sm">
|
|
<div class="card-body text-center text-body-secondary py-5">
|
|
No encounters yet. Name one above, or go to <strong>Enemies</strong>, tick the combatants
|
|
you want and add them to a new encounter.
|
|
</div>
|
|
</div>
|
|
{% else %}
|
|
<div class="list-group shadow-sm">
|
|
{% for e in encounters %}
|
|
<a href="{{ path('app_tracker_show', {id: e.id}) }}"
|
|
class="list-group-item list-group-item-action d-flex justify-content-between align-items-center">
|
|
<span>
|
|
<span class="fw-semibold">{{ e.name }}</span>
|
|
<span class="text-body-secondary small">
|
|
· {{ e.combatants|length }} combatant{{ e.combatants|length == 1 ? '' : 's' }}
|
|
</span>
|
|
</span>
|
|
<span class="text-body-secondary small">updated {{ e.updatedAt|date('Y-m-d H:i') }}</span>
|
|
</a>
|
|
{% endfor %}
|
|
</div>
|
|
{% endif %}
|
|
{% endblock %}
|