avalon-django/avalon/avalon_game/templates/role_phase.html
Daniel Perelman 79fb7d7b97 Implemented observer view for a computer visible to all players. (#15)
* 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.
2017-05-07 14:51:29 -07:00

44 lines
1.5 KiB
HTML

{% extends "in_game.html" %}
{% block game_content %}
<div class="role-phase">
<h2>Role Phase{% if times_started > 1 %}
<b>#{{times_started}}</b>
{% endif %}</h2>
<p><b>Ready up!</b></p>
<ul>
{% for p in players %}
<li id="player-{{ p.order }}" class="{% if p.ready %}ready{% endif %}{% if p == player %} this-player{% endif %}">
{{ p.name }}
</li>
{% endfor %}
</ul>
<form method="post">
{% csrf_token %}
<div class="button-container">
{% if not is_observer %}
<button type="submit" formaction="{% url 'ready' access_code=access_code player_secret=player_secret %}">Ready</button>
{% endif %}
<button type="submit" formaction="{% if is_observer %}{% url 'observe_cancel_game' access_code=access_code %}{% else %}{% url 'cancel_game' access_code=access_code player_secret=player_secret %}{% endif %}">Return to Lobby</button>
</div>
</form>
</div>
{% endblock %}
{% block game_handle_new_status %}
if(oldStatus.game_phase == newStatus.game_phase
&& oldStatus.times_started == newStatus.times_started) {
if(JSON.stringify(oldStatus.ready)
!= JSON.stringify(newStatus.ready)) {
newStatus.ready.forEach(function(player) {
$('#player-' + player.order).addClass('ready');
});
statusObj.ready = newStatus.ready;
}
return true;
} else {
return false;
}
{% endblock %}