From 8021b457b6e0193b047f90de196963ee6460eaf1 Mon Sep 17 00:00:00 2001 From: Mrks <68022469+mrkssr@users.noreply.github.com> Date: Mon, 23 Sep 2024 23:19:26 +0200 Subject: [PATCH] WebHost: Added Games Of A Seed To The User Content Page (#3585) * Added contained games of a seed to the user content page as tooltip. * Changed sort handling. * Limited amount of shown games. * Added missing dashes. Co-authored-by: Kory Dondzila * Closing a-tags. Co-authored-by: Kory Dondzila * Closing a-tags. Co-authored-by: Kory Dondzila * Moved games list to table cell level. Co-authored-by: Kory Dondzila * Moved games list to table cell level. --------- Co-authored-by: Kory Dondzila --- WebHostLib/templates/userContent.html | 31 +++++++++++++++++++++++---- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/WebHostLib/templates/userContent.html b/WebHostLib/templates/userContent.html index 71a0f674..4e3747f4 100644 --- a/WebHostLib/templates/userContent.html +++ b/WebHostLib/templates/userContent.html @@ -1,5 +1,21 @@ {% extends 'tablepage.html' %} +{%- macro games(slots) -%} + {%- set gameList = [] -%} + {%- set maxGamesToShow = 10 -%} + + {%- for slot in (slots|list|sort(attribute="player_id"))[:maxGamesToShow] -%} + {% set player = "#" + slot["player_id"]|string + " " + slot["player_name"] + " : " + slot["game"] -%} + {% set _ = gameList.append(player) -%} + {%- endfor -%} + + {%- if slots|length > maxGamesToShow -%} + {% set _ = gameList.append("... and " + (slots|length - maxGamesToShow)|string + " more") -%} + {%- endif -%} + + {{ gameList|join('\n') }} +{%- endmacro -%} + {% block head %} {{ super() }} User Content @@ -33,10 +49,12 @@ {{ room.seed.id|suuid }} {{ room.id|suuid }} - {{ room.seed.slots|length }} + + {{ room.seed.slots|length }} + {{ room.creation_time.strftime("%Y-%m-%d %H:%M") }} {{ room.last_activity.strftime("%Y-%m-%d %H:%M") }} - Delete next maintenance. + Delete next maintenance. {% endfor %} @@ -60,10 +78,15 @@ {% for seed in seeds %} {{ seed.id|suuid }} - {% if seed.multidata %}{{ seed.slots|length }}{% else %}1{% endif %} + + {% if seed.multidata %} + {{ seed.slots|length }} + {% else %} + 1 + {% endif %} {{ seed.creation_time.strftime("%Y-%m-%d %H:%M") }} - Delete next maintenance. + Delete next maintenance. {% endfor %}