Tracker: unfold a combatant's stat block inline
- extract the 5e stat-block markup into enemy/_statblock.html.twig (sb.block(enemy) macro); the enemy detail page now uses it too - each tracker combatant gets a "stat block" toggle that expands the block in place (Bootstrap collapse), so you don't have to leave the encounter to check AC / attacks - open blocks are remembered in localStorage and re-opened after each damage/heal reload, and the caret rotates when expanded Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,8 @@
|
||||
|
||||
{% block title %}{{ encounter.name }} · Tracker · dmtools{% endblock %}
|
||||
|
||||
{% import 'enemy/_statblock.html.twig' as sb %}
|
||||
|
||||
{% block body %}
|
||||
<div class="d-flex justify-content-between align-items-start mb-3 gap-3 flex-wrap">
|
||||
<div>
|
||||
@@ -52,8 +54,12 @@
|
||||
{% if c.isDown %}<span class="badge text-bg-secondary ms-1">Down</span>{% endif %}
|
||||
</div>
|
||||
{% if c.enemy %}
|
||||
<a href="{{ path('app_enemies_show', {id: c.enemy.id}) }}"
|
||||
class="small text-decoration-none text-body-secondary">stat block</a>
|
||||
<button type="button"
|
||||
class="btn btn-link btn-sm p-0 text-decoration-none text-body-secondary"
|
||||
data-bs-toggle="collapse" data-bs-target="#sb-{{ c.id }}"
|
||||
aria-expanded="false" aria-controls="sb-{{ c.id }}">
|
||||
<span class="sb-caret">▸</span> stat block
|
||||
</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
@@ -85,6 +91,15 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% if c.enemy %}
|
||||
<div class="collapse statblock-collapse mt-2 pt-2 border-top" id="sb-{{ c.id }}">
|
||||
<p class="text-body-secondary fst-italic small mb-2">{{ c.enemy.metaLine }}</p>
|
||||
<div class="small">{{ sb.block(c.enemy) }}</div>
|
||||
<a href="{{ path('app_enemies_show', {id: c.enemy.id}) }}"
|
||||
class="small text-decoration-none">Open full stat block →</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
|
||||
Reference in New Issue
Block a user