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