From 4e1f55855d3991aa18f60d8d688cc5316c899049 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Kucharczyk?= Date: Thu, 15 Jan 2026 22:43:17 +0100 Subject: [PATCH] Update history when status changes --- games/templates/partials/history.html | 6 ++++++ games/templates/view_game.html | 14 ++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) create mode 100644 games/templates/partials/history.html diff --git a/games/templates/partials/history.html b/games/templates/partials/history.html new file mode 100644 index 0000000..a2c44a1 --- /dev/null +++ b/games/templates/partials/history.html @@ -0,0 +1,6 @@ + \ No newline at end of file diff --git a/games/templates/view_game.html b/games/templates/view_game.html index d120deb..91f38fc 100644 --- a/games/templates/view_game.html +++ b/games/templates/view_game.html @@ -75,7 +75,10 @@ 'X-CSRFToken': '{{ csrf_token }}' }, body: JSON.stringify({ status: newStatus }) - }).finally(() => this.saving = false); + }).then(() => { + document.body.dispatchEvent(new CustomEvent('status-changed')); + }) + .finally(() => this.saving = false); } }" > @@ -204,14 +207,9 @@ No play events yet. {% endif %} -
+
History -
    - {% for change in statuschanges %} -
  • - {% if change.timestamp %}{{ change.timestamp | date:"d/m/Y H:i" }}: Changed{% else %}At some point changed{% endif %} status from {{ change.get_old_status_display }} to {{ change.get_new_status_display }} (Edit, Delete)
  • - {% endfor %} -
+ {% include "partials/history.html" %}