Fix states click on other characters

This commit is contained in:
Gabriel Augendre 2022-11-06 15:49:39 +01:00
parent 67fcfa633d
commit b929cb6cbd

View file

@ -1,3 +1,4 @@
{% load character_extras %}
<p id="states">
États :
{% with character.states.all as character_states %}
@ -8,12 +9,16 @@
data-bs-title="{{ state.name }} : {{ state.description }}"
{% if state in character_states %}
class="state-enabled"
{% endif %}
{% if character|managed_by:user %}
{% if state in character_states %}
hx-get="{% url "character:remove_state" pk=character.pk state_pk=state.pk %}"
{% else %}
hx-get="{% url "character:add_state" pk=character.pk state_pk=state.pk %}"
{% endif %}
hx-target="#states"
hx-swap="outerHTML"
{% endif %}
>
{% endfor %}
{% endwith %}