avalon-django/avalon/avalon_game/templates/role_phase.html

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 %}