tabletop-frog/ttfrog/assets/templates/character_sheet.html

187 lines
5.5 KiB
HTML
Raw Normal View History

2024-01-31 22:39:54 -08:00
{% extends "base.html" %}
{% set DISABLED = False if c.record.id else True %}
2024-01-31 22:39:54 -08:00
{% macro field(name, disabled=False) %}
{% set default_value = c.record[name] if c.record.id else c.form[name].default %}
{{ c.form[name](disabled=disabled, **{'data-initial_value': default_value}) }}
{% endmacro %}
2024-02-01 00:28:17 -08:00
{% block content %}
2024-02-01 00:28:17 -08:00
<div id='sheet_container'>
2024-01-31 22:39:54 -08:00
<form name="character_sheet" method="post" novalidate class="form">
2024-02-08 01:14:35 -08:00
<div class='banner'>
<div><img id='portrait' /></div>
<div>
{{ field('name') }}
{{ field('ancestry') }} {{ c.record.character_class|join(' / ') }} &nbsp; Level {{ field('level') }}
<div id='controls'>
{{ c.form.save }} &nbsp; {{ c.form.delete }}
</div>
2024-02-08 01:14:35 -08:00
</div>
</div>
</div>
<div id='character_sheet' {% if not c.record.id %}class='disabled'{% endif %} >
2024-02-08 01:14:35 -08:00
<div class='stats'>
{% for stat in ['str', 'dex', 'con', 'int', 'wis', 'cha'] %}
<div class='card'>
<div class='label'>{{ c.form[stat].label }}</div>
{{ field(stat, DISABLED) }}
<div id='{{stat}}_bonus'></div>
</div>
2024-02-08 01:14:35 -08:00
{% endfor %}
<div id='hp' class='card'>
<div class='label'>HP</div>
{{ field('hit_points', DISABLED) }} / {{ field('max_hit_points', DISABLED) }}
<div id='temp_hp'>
<span class='label'>TEMP</span> {{ field('temp_hit_points', DISABLED) }}
2024-02-08 01:14:35 -08:00
</div>
</div>
<div id='skills'>
<div class='label'>Skills</div>
<table>
{% for skill in c.record.skills %}
<tr><td>{{ skill }}</td><td>3</td></tr>
{% endfor %}
</table>
</div>
<div id='saves' class='card'>
<div class='label'>Saving Throws</div>
{% for save in c.record.saving_throws %}
{{ save }} 3&nbsp;
{% endfor %}
</div>
<div id='proficiency' class='card'>
<div class='label'>PROF</div>
<div id='proficiency_bonus'></div>
<div class='label'>BONUS</div>
</div>
<div id="ac" class='card'>
<div class='label'>Armor</div>
{{ field('armor_class', DISABLED) }}
<div class='label'>Class</div>
</div>
<div id='initiative' class='card'>
<div class='label'>Initiative</div>
<span id='initiative_bonus'>3 </span>
<div class='label'>Bonus</div>
</div>
<div id='speed' class='card'>
<div class='label'>Speed</div>
{{ field('speed', DISABLED) }}
</div>
<div id="actions" class='card'>
<table>
<tr>
<td class='label' colspan='2'>Actions</td>
<td class='label'>To Hit</td>
<td class='label'>Range</td>
<td class='label'>Targets</td>
<td class='label'>Damage</td>
</tr>
<tr>
<th>Attack</th>
<td>Dagger</td>
<td>+7</td>
<td>5</td>
<td>1</td>
<td>1d4+3 slashing</td>
</tr>
<tr>
<th>Attack</th>
<td>Sabetha's Fans</td>
<td>+7</td>
<td>5</td>
<td>1</td>
<td>2d6 slashing</td>
</tr>
<tr>
<th>Spell</th>
<td>Eldritch Blast</td>
<td>+5</td>
<td>120</td>
<td>1</td>
<td>1d10 force</td>
</tr>
<tr>
<td class='label' colspan='2'>Bonus Actions</td>
<td class='label'>To Hit</td>
<td class='label'>Range</td>
<td class='label'>Targets</td>
<td class='label'>Damage</td>
</tr>
</table>
<p>
<span class='note'>
Attack (1 per Action), Cast a Spell, Dash, Disengage, Dodge, Grapple,<br>Help, Hide, Improvise, Ready, Search, Shove, or Use an Object
</span>
</p>
</div>
2024-02-08 01:14:35 -08:00
</div>
<!-- SIDEBAR -->
2024-02-08 01:14:35 -08:00
<div class='sidebar'>
<div class='card'>
<div class='label'>Inspiration</div>
<ul>
</ul>
</div>
<div class='card'>
<div class='label'>Conditions</div>
<ul>
</ul>
</div>
<div class='card'>
<div class='label'>Defenses</div>
<ul>
<li>Vulnerable to Fire</li>
<li>Immune to Cold</li>
<li>Resistant to Poison</li>
</ul>
2024-02-08 01:14:35 -08:00
</div>
</div>
</div>
<hr>
{{ c.form.csrf_token }}
</form>
2024-01-31 22:39:54 -08:00
{% endblock %}
{% block debug %}
2024-02-01 00:28:17 -08:00
<div style='clear:both;display:block;'>
2024-01-31 22:39:54 -08:00
<h2>Debug</h2>
2024-02-08 01:14:35 -08:00
<code>
{{ DISABLED }}
<code>
2024-02-02 15:40:45 -08:00
{{ c }}
2024-02-08 01:14:35 -08:00
</code>
2024-01-31 22:39:54 -08:00
{% endblock %}
{% block script %}
<script type='text/javascript'>
{% for field, msg in c.form.errors.items() %}
console.log("{{ field }}: {{ msg }}");
{% endfor %}
const TRAITS = {
{% for trait_desc, traits in c.traits.items() %}
'{{ trait_desc }}': [
{% for trait in traits %}
{
"type": "{{ trait['type'] }}",
"target": "{{ trait.target }}",
"value": "{{ trait.value }}",
},
{% endfor %}
],
{% endfor %}
};
</script>
{% endblock %}