diff --git a/.idea/charasheet.iml b/.idea/charasheet.iml index 955f981..23b0b5e 100644 --- a/.idea/charasheet.iml +++ b/.idea/charasheet.iml @@ -19,6 +19,7 @@ + diff --git a/src/common/static/style.css b/src/common/static/style.css index 5fddcf2..b6f990a 100644 --- a/src/common/static/style.css +++ b/src/common/static/style.css @@ -22,18 +22,3 @@ img.profile-pic { max-height: 240px; object-fit: cover; } - -#effects-list { - display: flex; - flex-direction: row; -} - -.effect { - width: 100px; - margin-right: 3em; - align-self: flex-end; -} - -.effect .bar { - background-color: red; -} diff --git a/src/party/models.py b/src/party/models.py index fd541b1..e30380a 100644 --- a/src/party/models.py +++ b/src/party/models.py @@ -100,3 +100,10 @@ class BattleEffect(TimeStampedModel, models.Model): ) objects = BattleEffectManager() + + @property + def remaining_percent(self) -> float: + max_display_percent = 5 + if self.remaining_rounds >= max_display_percent or self.remaining_rounds < 0: + return 100 + return self.remaining_rounds / max_display_percent * 100 diff --git a/src/party/templates/party/party_details.html b/src/party/templates/party/party_details.html index d884043..94481c9 100644 --- a/src/party/templates/party/party_details.html +++ b/src/party/templates/party/party_details.html @@ -11,7 +11,7 @@ Réinitialiser les stats

-

Personnages

+

Personnages

{% for character in party.characters.all %} {% include "character/snippets/characters_list/character_card.html" %} @@ -21,7 +21,7 @@
{% with party.invited_characters.all as invites %} {% if invites %} -

Invités

+

Invités

{% for character in invites %} {% include "character/snippets/characters_list/character_card.html" %} @@ -29,6 +29,6 @@
{% endif %} {% endwith %} -

Combat

+

Combat

{% include "party/snippets/effects.html" %} {% endblock %} diff --git a/src/party/templates/party/snippets/effect_card.html b/src/party/templates/party/snippets/effect_card.html new file mode 100644 index 0000000..e1f82af --- /dev/null +++ b/src/party/templates/party/snippets/effect_card.html @@ -0,0 +1,32 @@ +{% with rounds=effect.remaining_rounds %} +
+
+
+
{{ effect.name }}
+
+ {{ effect.created_by.get_full_name|default:effect.created_by.username }} + {{ effect.target }} +
+

{{ effect.description }}

+
+ +
+
+{% endwith %} diff --git a/src/party/templates/party/snippets/effects.html b/src/party/templates/party/snippets/effects.html index b4f8866..345f697 100644 --- a/src/party/templates/party/snippets/effects.html +++ b/src/party/templates/party/snippets/effects.html @@ -9,14 +9,9 @@ class="btn btn-primary"> Ajouter un effet -
+
{% for effect in party.effects.all %} -
-
-
{{ effect.name }}
-
sur : {{ effect.target }}
-
{{ effect.description }}
-
+ {% include "party/snippets/effect_card.html" %} {% endfor %}