Daniel Perelman
79fb7d7b97
* Implemented observer view for a computer visible to all players. * Updated New Game and Join Game pages/forms so observe button requires name to be blank and joining as a player requires name to be non-blank. * Highlight more clearly what player is on a device to make the observer more clearly separate. Closes #4.
59 lines
2.0 KiB
HTML
59 lines
2.0 KiB
HTML
{% extends "in_game.html" %}
|
|
|
|
{% block game_content %}
|
|
<div class="voting-phase">
|
|
<h2>Voting Phase</h2>
|
|
</div>
|
|
|
|
<p><b>Please vote on the following team:</b></p>
|
|
<ul>
|
|
{% for p in chosen %}
|
|
<li>{{ p.name }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
|
|
<p><b>Waiting for <span id="missing-votes">{% if missing_votes_count == 1 %}1 person{% else %}{{ missing_votes_count }} people{% endif %}</span> to vote.</b></p>
|
|
|
|
{% if not is_observer %}
|
|
<form method="post">
|
|
{% csrf_token %}
|
|
<div class="button-container">
|
|
{% if swap_buttons %}
|
|
{% block reject-button %}{% endblock %}
|
|
{% block accept-button %}{% endblock %}
|
|
{% else %}
|
|
{% block accept-button-2 %}{% endblock %}
|
|
{% block reject-button-2 %}{% endblock %}
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if player == leader %}
|
|
<div class="button-container">
|
|
<button type="submit" formaction="{% url 'retract_team' access_code=access_code player_secret=player_secret round_num=round_num vote_num=vote_num %}" class="button-cancel">Change team</button>
|
|
</div>
|
|
{% endif %}
|
|
{% endif %}
|
|
|
|
{% if player_vote %}
|
|
<p>You are voting: {{ player_vote }}</p>
|
|
<div class="button-container">
|
|
<button type="submit" formaction="{% url 'vote' access_code=access_code player_secret=player_secret round_num=round_num vote_num=vote_num vote='cancel' %}" class="button-cancel-vote">Retract vote</button>
|
|
</div>
|
|
</form>
|
|
{% endif %}
|
|
{% endblock %}
|
|
|
|
{% block game_handle_new_status %}
|
|
if(oldStatus.game_phase == newStatus.game_phase
|
|
&& oldStatus.round_num == newStatus.round_num
|
|
&& oldStatus.vote_num == newStatus.vote_num
|
|
&& oldStatus.player_vote == newStatus.player_vote) {
|
|
$("#missing-votes").text(newStatus.missing_votes_count == 1
|
|
? "1 person"
|
|
: (newStatus.missing_votes_count + " people"));
|
|
return true;
|
|
} else {
|
|
return false;
|
|
}
|
|
{% endblock %}
|