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 <kory.dondzila@atomicobject.com>

* Closing a-tags.

Co-authored-by: Kory Dondzila <kory.dondzila@atomicobject.com>

* Closing a-tags.

Co-authored-by: Kory Dondzila <kory.dondzila@atomicobject.com>

* Moved games list to table cell level.

Co-authored-by: Kory Dondzila <kory.dondzila@atomicobject.com>

* Moved games list to table cell level.

---------

Co-authored-by: Kory Dondzila <kory.dondzila@atomicobject.com>
This commit is contained in:
Mrks 2024-09-23 23:19:26 +02:00 committed by GitHub
parent d43dc62485
commit 8021b457b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 27 additions and 4 deletions

View File

@ -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() }}
<title>User Content</title>
@ -33,10 +49,12 @@
<tr>
<td><a href="{{ url_for("view_seed", seed=room.seed.id) }}">{{ room.seed.id|suuid }}</a></td>
<td><a href="{{ url_for("host_room", room=room.id) }}">{{ room.id|suuid }}</a></td>
<td>{{ room.seed.slots|length }}</td>
<td title="{{ games(room.seed.slots) }}">
{{ room.seed.slots|length }}
</td>
<td>{{ room.creation_time.strftime("%Y-%m-%d %H:%M") }}</td>
<td>{{ room.last_activity.strftime("%Y-%m-%d %H:%M") }}</td>
<td><a href="{{ url_for("disown_room", room=room.id) }}">Delete next maintenance.</td>
<td><a href="{{ url_for("disown_room", room=room.id) }}">Delete next maintenance.</a></td>
</tr>
{% endfor %}
</tbody>
@ -60,10 +78,15 @@
{% for seed in seeds %}
<tr>
<td><a href="{{ url_for("view_seed", seed=seed.id) }}">{{ seed.id|suuid }}</a></td>
<td>{% if seed.multidata %}{{ seed.slots|length }}{% else %}1{% endif %}
<td title="{{ games(seed.slots) }}">
{% if seed.multidata %}
{{ seed.slots|length }}
{% else %}
1
{% endif %}
</td>
<td>{{ seed.creation_time.strftime("%Y-%m-%d %H:%M") }}</td>
<td><a href="{{ url_for("disown_seed", seed=seed.id) }}">Delete next maintenance.</td>
<td><a href="{{ url_for("disown_seed", seed=seed.id) }}">Delete next maintenance.</a></td>
</tr>
{% endfor %}
</tbody>