Improve button controls

This commit is contained in:
Gabriel Augendre 2022-10-30 22:35:06 +01:00
parent 72bd9ec079
commit eb3c54c54b

View file

@ -68,7 +68,7 @@
<tr> <tr>
<th scope="row">Initiative</th> <th scope="row">Initiative</th>
<td data-bs-toggle="tooltip" <td data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="left"
data-bs-title="valeur DEX"> data-bs-title="valeur DEX">
{{ character.initiative }} {{ character.initiative }}
</td> </td>
@ -76,7 +76,7 @@
<tr> <tr>
<th scope="row">Att. contact</th> <th scope="row">Att. contact</th>
<td data-bs-toggle="tooltip" <td data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="left"
data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_strength }} (mod. FOR)"> data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_strength }} (mod. FOR)">
{{ character.attack_melee|modifier }} {{ character.attack_melee|modifier }}
</td> </td>
@ -84,7 +84,7 @@
<tr> <tr>
<th scope="row">Att. distance</th> <th scope="row">Att. distance</th>
<td data-bs-toggle="tooltip" <td data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="left"
data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_dexterity }} (mod. DEX)"> data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_dexterity }} (mod. DEX)">
{{ character.attack_range|modifier }} {{ character.attack_range|modifier }}
</td> </td>
@ -92,7 +92,7 @@
<tr> <tr>
<th scope="row">Att. magique</th> <th scope="row">Att. magique</th>
<td data-bs-toggle="tooltip" <td data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="left"
data-bs-title="{{ character.level }} (niveau) + {{ character.attack_magic|sub:character.level }} (mod. {{ character.profile.magical_strength }})"> data-bs-title="{{ character.level }} (niveau) + {{ character.attack_magic|sub:character.level }} (mod. {{ character.profile.magical_strength }})">
{{ character.attack_magic|modifier }} {{ character.attack_magic|modifier }}
</td> </td>
@ -100,7 +100,7 @@
<tr> <tr>
<th scope="row">Défense</th> <th scope="row">Défense</th>
<td data-bs-toggle="tooltip" <td data-bs-toggle="tooltip"
data-bs-placement="top" data-bs-placement="left"
data-bs-title="10 + {{ character.armor }} (armor) + {{ character.shield }} (shield) + {{ character.modifier_dexterity }} (mod. DEX) + {{ character.defense_misc }} (misc)"> data-bs-title="10 + {{ character.armor }} (armor) + {{ character.shield }} (shield) + {{ character.modifier_dexterity }} (mod. DEX) + {{ character.defense_misc }} (misc)">
{{ character.defense }} {{ character.defense }}
</td> </td>
@ -114,144 +114,140 @@
<tr><th scope="col" colspan="2">Énergie</th></tr> <tr><th scope="col" colspan="2">Énergie</th></tr>
</thead> </thead>
<tbody class="table-group-divider"> <tbody class="table-group-divider">
<tr>
<th scope="row">PV max</th>
<td>{{ character.health_max }}</td>
</tr>
<tr> <tr>
<th scope="row"> <th scope="row">
PV restants PV
<div class="btn-group btn-group-sm" role="group"> <div class="btn-group btn-group-sm float-end" role="group">
<button <button
hx-get="{% url "character:health_change" pk=character.pk %}?value=ko" hx-get="{% url "character:health_change" pk=character.pk %}?value=ko"
hx-target="#health-remaining" hx-target="#health-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-outline-danger">0</button> class="btn btn-outline-danger"><i class="fa-solid fa-battery-empty"></i></button>
<button <button
hx-get="{% url "character:health_change" pk=character.pk %}?value=-1" hx-get="{% url "character:health_change" pk=character.pk %}?value=-1"
hx-target="#health-remaining" hx-target="#health-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-danger">-</button> class="btn btn-danger"><i class="fa-solid fa-minus"></i></button>
<button <button
hx-get="{% url "character:health_change" pk=character.pk %}?value=1" hx-get="{% url "character:health_change" pk=character.pk %}?value=1"
hx-target="#health-remaining" hx-target="#health-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-success">+</button> class="btn btn-success"><i class="fa-solid fa-plus"></i></button>
<button <button
hx-get="{% url "character:health_change" pk=character.pk %}?value=max" hx-get="{% url "character:health_change" pk=character.pk %}?value=max"
hx-target="#health-remaining" hx-target="#health-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-outline-success">max</button> class="btn btn-outline-success"><i class="fa-solid fa-battery-full"></i></button>
</div> </div>
</th> </th>
<td id="health-remaining">{{ character.health_remaining }}</td> <td><span id="health-remaining">{{ character.health_remaining }}</span> / {{ character.health_max }}</td>
</tr>
<tr>
<th scope="row">PM max</th>
<td data-bs-toggle="tooltip"
data-bs-placement="top"
{% if character.profile.mana_max_compute == 1 %}
data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_magic }} (mod. {{ character.profile.magical_strength }})"
{% elif character.profile.mana_max_compute == 2 %}
data-bs-title="2 x {{ character.level }} (niveau) + {{ character.modifier_magic }} (mod. {{ character.profile.magical_strength }})"
{% endif %}
>
{{ character.mana_max }}
</td>
</tr> </tr>
<tr> <tr>
<th scope="row"> <th scope="row">
PM restants PM
<div class="btn-group btn-group-sm" role="group"> <div class="btn-group btn-group-sm float-end" role="group">
<button <button
hx-get="{% url "character:mana_change" pk=character.pk %}?value=ko" hx-get="{% url "character:mana_change" pk=character.pk %}?value=ko"
hx-target="#mana-remaining" hx-target="#mana-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-outline-danger">0</button> class="btn btn-outline-danger"><i class="fa-solid fa-battery-empty"></i></button>
<button <button
hx-get="{% url "character:mana_change" pk=character.pk %}?value=-1" hx-get="{% url "character:mana_change" pk=character.pk %}?value=-1"
hx-target="#mana-remaining" hx-target="#mana-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-danger">-</button> class="btn btn-danger"><i class="fa-solid fa-minus"></i></button>
<button <button
hx-get="{% url "character:mana_change" pk=character.pk %}?value=1" hx-get="{% url "character:mana_change" pk=character.pk %}?value=1"
hx-target="#mana-remaining" hx-target="#mana-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-success">+</button> class="btn btn-success"><i class="fa-solid fa-plus"></i></button>
<button <button
hx-get="{% url "character:mana_change" pk=character.pk %}?value=max" hx-get="{% url "character:mana_change" pk=character.pk %}?value=max"
hx-target="#mana-remaining" hx-target="#mana-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-outline-success">max</button> class="btn btn-outline-success"><i class="fa-solid fa-battery-full"></i></button>
</div> </div>
</th> </th>
<td id="mana-remaining">{{ character.mana_remaining }}</td> <td data-bs-toggle="tooltip"
data-bs-placement="left"
{% if character.profile.mana_max_compute == 1 %}
data-bs-title="{{ character.level }} (niveau) + {{ character.modifier_magic }} (mod. {{ character.profile.magical_strength }})"
{% elif character.profile.mana_max_compute == 2 %}
data-bs-title="2 x {{ character.level }} (niveau) + {{ character.modifier_magic }} (mod. {{ character.profile.magical_strength }})"
{% endif %}>
<span id="mana-remaining">{{ character.mana_remaining }}</span> / {{ character.mana_max }}
</td>
<tr> <tr>
<th scope="row">PR max</th> <th scope="row">
<td>{{ character.recovery_points_max }}</td> PR
</tr> <div class="btn-group btn-group-sm float-end" role="group">
<tr> <button
<th scope="row" type="button"
data-bs-toggle="tooltip" disabled
data-bs-placement="top" class="btn btn-outline-secondary"><i class="fa-solid fa-battery-empty"></i></button>
data-bs-title="[1 dé de vie + {{ character.modifier_constitution|add:character.level }}] PV">
PR restants
<div class="btn-group btn-group-sm" role="group">
<button <button
hx-get="{% url "character:recovery_points_change" pk=character.pk %}?value=-1" hx-get="{% url "character:recovery_points_change" pk=character.pk %}?value=-1"
hx-target="#recovery-points-remaining" hx-target="#recovery-points-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-danger">-</button> class="btn btn-danger"><i class="fa-solid fa-minus"></i></button>
<button <button
hx-get="{% url "character:recovery_points_change" pk=character.pk %}?value=1" hx-get="{% url "character:recovery_points_change" pk=character.pk %}?value=1"
hx-target="#recovery-points-remaining" hx-target="#recovery-points-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-success">+</button> class="btn btn-success"><i class="fa-solid fa-plus"></i></button>
<button
type="button"
disabled
class="btn btn-outline-secondary"><i class="fa-solid fa-battery-full"></i></button>
</div> </div>
</th> </th>
<td id="recovery-points-remaining">{{ character.recovery_points_remaining }}</td> <td data-bs-toggle="tooltip"
data-bs-placement="left"
data-bs-title="[1 dé de vie + {{ character.modifier_constitution|add:character.level }}] PV">
<span id="recovery-points-remaining">{{ character.recovery_points_remaining }}</span> / {{ character.recovery_points_max }}</td>
<tr> <tr>
<th scope="row">PC max</th> <th scope="row">
<td>{{ character.luck_points_max }}</td> PC
</tr> <div class="btn-group btn-group-sm float-end" role="group">
<tr> <button
<th scope="row" type="button"
data-bs-toggle="tooltip" disabled
data-bs-placement="top" class="btn btn-outline-secondary"><i class="fa-solid fa-battery-empty"></i></button>
data-bs-title="[1 dé de vie + {{ character.modifier_constitution|add:character.level }}] PV">
PC restants
<div class="btn-group btn-group-sm" role="group">
<button <button
hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=-1" hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=-1"
hx-target="#luck-points-remaining" hx-target="#luck-points-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-danger">-</button> class="btn btn-danger"><i class="fa-solid fa-minus"></i></button>
<button <button
hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=1" hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=1"
hx-target="#luck-points-remaining" hx-target="#luck-points-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-success">+</button> class="btn btn-success"><i class="fa-solid fa-plus"></i></button>
<button <button
hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=max" hx-get="{% url "character:luck_points_change" pk=character.pk %}?value=max"
hx-target="#luck-points-remaining" hx-target="#luck-points-remaining"
hx-swap="innerHTML" hx-swap="innerHTML"
type="button" type="button"
class="btn btn-outline-success">max</button> class="btn btn-outline-success"><i class="fa-solid fa-battery-full"></i></button>
</div> </div>
</th> </th>
<td id="luck-points-remaining">{{ character.luck_points_remaining }}</td> <td data-bs-toggle="tooltip"
data-bs-placement="left"
data-bs-title="[1 dé de vie + {{ character.modifier_constitution|add:character.level }}] PV">
<span id="luck-points-remaining">{{ character.luck_points_remaining }}</span> / {{ character.luck_points_max }}
</td>
</tr> </tr>
</tbody> </tbody>
</table> </table>