51 lines
1.4 KiB
HTML
51 lines
1.4 KiB
HTML
|
<!-- HTML -->
|
||
|
<!DOCTYPE html>
|
||
|
<html>
|
||
|
<head>
|
||
|
<title>Join Game</title>
|
||
|
</head>
|
||
|
<body>
|
||
|
{% if game_id %}
|
||
|
<p>Selected game to join is: {{ game_id }}</p>
|
||
|
{% endif %}
|
||
|
|
||
|
{% if players %}
|
||
|
<p>Players in game:</p>
|
||
|
<ul>
|
||
|
{% for player in players %}
|
||
|
<li>{{ player }}</li>
|
||
|
{% endfor %}
|
||
|
</ul>
|
||
|
<!-- form to select one player to play as, or to select spectator too play as -->
|
||
|
<form method="POST" action="/join_game/{{ game_id }}">
|
||
|
<select name="player">
|
||
|
<option value="" selected disabled>Select player</option>
|
||
|
<option value="spectator">Spectator</option>
|
||
|
{% for player in players %}
|
||
|
<option value="{{ player }}">{{ player }}</option>
|
||
|
{% endfor %}
|
||
|
</select>
|
||
|
<input type="submit" value="Join Game">
|
||
|
</form>
|
||
|
{% else %}
|
||
|
<p>No players found in game, please recreate the game.</p>
|
||
|
{% endif %}
|
||
|
|
||
|
{% if player_name %}
|
||
|
<p>Selected player to join as: {{ player_name }}</p>
|
||
|
<script>
|
||
|
// Save player name in browser session for auto fill in game page
|
||
|
sessionStorage.setItem('player_name', '{{ player_name }}');
|
||
|
//redirect to game
|
||
|
window.location.href = '/game/{{ game_id }}/player/{{ player_name }}';
|
||
|
</script>
|
||
|
<noscript>
|
||
|
<p>manual redirect</p>
|
||
|
<a href="/game/{{ game_id }}/player/{{ player_name }}">Go to game</a>
|
||
|
</noscript>
|
||
|
{% endif %}
|
||
|
|
||
|
|
||
|
|
||
|
</body>
|
||
|
</html>
|