avalon-django/avalon/avalon_game/templates/in_game.html
Daniel Perelman b69b21d518 Add private voting (show vote totals only) mode. Closes #14. (#23)
* Add flag for private voting.
* Always show numbers after a vote.
* Add vote totals to history table and respect private voting flag.
* Make votes no longer private once game is over.
2017-09-08 22:53:08 -07:00

167 lines
5.3 KiB
HTML

{% extends "game.html" %}
{% block game_header %}
<div class="available-roles">
There are <b>{{ num_players }}</b> players:
<b class="spy">{{ num_spies }} spies</b>
{% if spy_roles %}
(including special roles
{% for role in spy_roles %}
{% if forloop.last and not forloop.first %}and{% endif %}
<b class = "spy">{{ role }}</b>
{% endfor %})
{% endif %}
and
<b class = "resistance">{{ num_resistance }} resistance</b>
{% if resistance_roles %}
(including special roles
{% for role in resistance_roles %}
{% if forloop.last and not forloop.first %}and{% endif %}
<b class = "resistance">{{ role }}</b>
{% endfor %})
{% endif %}
</div>
<div class="role-info">
<hr class="small-hr">
{% if not is_observer %}
<div id="role-info">
<p>Team: <b class="{{ player.team }}">{{ player.team|title }}</b> | Role: {{ player.role_string }}</p>
{% if player.is_spy and not player.is_oberon %}
<p>Other spies:
{% for spy in visible_spies %}
{% if spy != player %}
<b class="spy">{{ spy.name }} </b>
{% endif %}
{% endfor %}
</p>
{% endif %}
{% if player.is_merlin %}
<p>The spies {% if game_has_mordred %}(except Mordred){% endif %} are:
{% for spy in visible_spies %}
<b class="spy">{{ spy.name }} </b>
{% endfor %}
</p>
{% endif %}
{% if player.is_percival %}
<p>Merlin is {{ possible_merlins }}.</p>
{% endif %}
{% if player.is_assassin %}
<p>Try to see if you can spot who the Merlin is. You'll have a chance to identify him at the end of the game to win it.</p>
{% endif %}
{% if player.is_morgana %}
<p>Percival sees you as Merlin.</p>
{% endif %}
{% if player.is_mordred %}
<p>Merlin does not know you are a spy.</p>
{% endif %}
</div>
<p id="role-info-hidden">
Tap to view role info
</p>
</div>
{% endif %}
<script>
$(document).ready(function () {
$('.role-info').click(function () {
$('#role-info').toggle();
$('#role-info-hidden').toggle();
})
})
</script>
{% endblock %}
{% block history %}
{{ debug }}
{% if not display_history and not game_over %}
<table id="player_order">
<thead>
<tr>
<th>Leader order</th>
</tr>
</thead>
<tbody>
{% for p in players %}
<tr>
<td>{{ p.name }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% else %}
<table id="history">
<thead>
<tr>
<th class="accept"></th>
<th class="reject"></th>
{% for p in players %}
<th><p><span{% if game_over %} class="{{ p.team }}"{% endif %}>{{ p.name }}</span></p></th>
{% endfor %}
</tr>
{% if game_over %}
<th colspan="2"></th>
{% for p in players %}
<th><p><span{% if game_over %} class="{{ p.team }}"{% endif %}>{{ p.role_string }}</span></p></th>
{% endfor %}
{% endif %}
</thead>
{% for game_round in game_rounds %}
<tbody>
{% for vote_round in game_round.voteround_set.all|dictsort:'vote_num' %}
<tr class="{% if forloop.revcounter0 > 0 %}reject
{% elif game_round.mission_passed != None %}{{ game_round.result_string }}
{% elif vote_round.is_waiting_on_leader %}pending
{% elif vote_round.is_currently_voting %}voting
{% elif vote_round.is_voting_complete %}{% if game_over %}reject{% else %}accept-pending{% endif %}
{% endif %}">
{% if vote_round.is_voting_complete %}
<td class="accept">{{ vote_round.vote_totals.accepts }}</td>
<td class="reject">{{ vote_round.vote_totals.rejects }}</td>
{% for pv in vote_round.playervote_set.all|dictsort:'player.order' %}
<td class="{% if pv.player == vote_round.leader %}leader{% endif %} {% if pv.player in vote_round.chosen.all %}chosen {% if game_over and vote_round.team_approved %}{% if pv.player in game_round.played_fail %}played-fail{% else %}played-success{% endif %}{% endif %}{% endif %} {% if not private_voting or game_over %}{% if pv.accept %}accept{% else %}reject{% endif %}{% endif %}"></td>
{% endfor %}
{% else %}
<td class="accept"></td>
<td class="reject"></td>
{% for p in players %}
<td class="{% if p == vote_round.leader %}leader{% endif %} {% if vote_round.is_team_finalized and p in vote_round.chosen.all %}chosen{% endif %}"></td>
{% endfor %}
{% endif %}
</tr>
{% endfor %}
{% if game_round.mission_passed != None %}
<tr class="summary {{ game_round.result_string }}">
<td colspan="{{ num_players|add:2 }}">
Mission {{ game_round.round_num }} {{ game_round.result_string }}ed
with {{ game_round.num_fails }} failures
</td>
</tr>
{% elif game_over %}
<tr class="summary fail">
<td colspan="{{ num_players|add:2 }}">
Mission {{ game_round.round_num }} failed as the resistance was unable
to choose a team 5 times in a row
</td>
</tr>
{% endif %}
</tbody>
{% endfor %}
{% if player_assassinated %}
<tbody>
<tr class="assassin-round">
{% for p in players %}
<td{% if p == player_assassinated %} class="assassinated"{% endif %}></td>
{% endfor %}
</tr>
</tbody>
{% endif %}
</table>
{% endif %}
{% endblock %}