Add admin "create game" form; show total time on session-creation dropdown
New game_admin_game_new route/form (reuses AdminGameType, same pattern as editing a game's total time) so games - including the 3 upcoming Easy/Medium/Hard difficulty options - can be created through the admin panel instead of needing a direct DB insert. Also show each game's total time (in minutes) next to the player count in the "Create New Session" dropdown, since that's the actual difficulty signal players are choosing between - number of players alone didn't convey it. Difficulty itself needs no new session-level concept: each difficulty is just a separate Game row with its own TOTAL_TIME setting, which checkAllPlayersReady() already reads when starting the session's timer. Hint timing depending on difficulty is separate, upcoming work.
This commit is contained in:
@@ -20,8 +20,15 @@
|
||||
<input type="hidden" name="_token" value="{{ csrf_token('create_session') }}">
|
||||
<select name="game_id" class="form-select mb-3">
|
||||
{% for game in availableGames %}
|
||||
{% set totalTime = null %}
|
||||
{% for setting in game.settings %}
|
||||
{% if setting.name.value == 'totalTime' %}
|
||||
{% set totalTime = setting.value %}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
<option value="{{ game.id }}">
|
||||
{{ game.name }} ({{ game.numberOfPlayers }} players)
|
||||
{{ game.name }} ({{ game.numberOfPlayers }} players{% if totalTime %}, {{ (totalTime / 60)|round }} min{% endif %})
|
||||
{% if is_granted('ROLE_ADMIN') %}
|
||||
[{{ game.status.value }}]
|
||||
{% endif %}
|
||||
|
||||
Reference in New Issue
Block a user