Dynamic number of players

This commit is contained in:
Frank
2026-01-08 15:49:47 +01:00
parent f8746207e6
commit 8e933631b2
8 changed files with 204 additions and 114 deletions

View File

@@ -69,11 +69,19 @@
</td>
<td>
<a href="{{ path('game', {session: session.id}) }}">Enter Game</a>
{% if session.status.value == 'created' and session.timer == 0 %}
<form method="post" style="display:inline;">
<input type="hidden" name="session_id" value="{{ session.id }}">
<button type="submit" name="leave_session" onclick="return confirm('Are you sure you want to leave this session?')">Leave Session</button>
</form>
{% if session.status.value == 'created' %}
{% if session.players|length >= session.game.numberOfPlayers %}
<form method="post" style="display:inline;">
<input type="hidden" name="session_id" value="{{ session.id }}">
<button type="submit" name="start_session">Start Session</button>
</form>
{% endif %}
{% if session.timer == 0 %}
<form method="post" style="display:inline;">
<input type="hidden" name="session_id" value="{{ session.id }}">
<button type="submit" name="leave_session" onclick="return confirm('Are you sure you want to leave this session?')">Leave Session</button>
</form>
{% endif %}
{% endif %}
</td>
</tr>