Add page for game see

This commit is contained in:
Léo 2020-05-08 22:24:21 +02:00
parent b949982cae
commit 76e7c92d9b
3 changed files with 48 additions and 2 deletions

View File

@ -313,7 +313,8 @@ def see_game(roomid):
if game is None:
return flask.redirect('/games')
if fll.current_user.level >= levels_users['Can manage games'] or game.authorized(fll.current_user) and game.turn==N_TURN*N_PLAYERS:
return game.serialize_state_anonymous()
#return game.serialize_state_anonymous()
return flask.render_template('game_see.html', user=fll.current_user, game=game, serialized=game.serialize_state_anonymous())
return flask.redirect(URL_DEFAULT)
@app.route('/admin/games/new', methods=['GET', 'POST'])

45
templates/game_see.html Normal file
View File

@ -0,0 +1,45 @@
{% extends "base.html" %}
{% block title %} Jeu {% endblock %}
{% block titre %} Jeu {{ game.name }} {% endblock %}
{% block contenu %}
<div id="zone-de-contenu">
<fieldset class="fieldset" ><legend style="font-size:25px;">Table</legend>
<p><b>Admin</b> : {{ game.admin }}</p>
<p><b>Nombre de parties</b> : {% if game.turn <= -8 %}{{ game.partie - 1 }}{% else %}{{ game.partie }}{% endif %}</p>
{% if game.start %}
{{lp}}
<table width=100%>
<tr style="font-weight:bold;"><td>Équipes</td><td style="text-align:center;">Points</td></tr>
<tr><td><ul>
<li>{{ serialized['playersinfo'][serialized['players'][0]] }} ({{ serialized['players'][0] }})
<li>{{ serialized['playersinfo'][serialized['players'][2]] }} ({{ serialized['players'][2] }})
</ul></td>
<td style="text-align:center">{{ game.cumul_0 }}</td>
</tr>
<tr><td><ul>
<li>{{ serialized['playersinfo'][serialized['players'][1]] }} ({{ serialized['players'][1] }})
<li>{{ serialized['playersinfo'][serialized['players'][3]] }} ({{ serialized['players'][3] }})
</ul></td>
<td style="text-align:center">{{ game.cumul_1 }}</td>
</tr>
</table>
{% endif %}
</fieldset>
{% if game.start %}
<fieldset class="fieldset" ><legend style="font-size:25px;">Partie en cours</legend>
<p><b>Tour</b> : {{ serialized['turn'] }}</p>
<p><b>Atout</b> : {% if serialized['atout'] is none %} - {% else %}{{ serialized['atout'] }}{% endif %}</p>
<p><b>Pris par</b> : {% if serialized['preneur'] is none %} - {% else %}{{ serialized['playersinfo'][serialized['preneur']] }} ({{ serialized['preneur'] }}){% endif %}</p>
<p><b>Cartes jouées</b> : {{ serialized['played'] }}</p>
{% set pj = (serialized['first_player'] + game.turn) % 4 %}
<p><b>Prochain joueur</b> : {{ serialized['playersinfo'][serialized['players'][pj]] }} ({{ serialized['players'][pj] }})</p>
</fieldset>
{% endif %}
</div>
{% endblock %}

View File

@ -6,6 +6,7 @@
{% block contenu %}
<div id="zone-de-contenu">
<div style="width:100%;text-align:right;padding-bottom:10px;"><a href="/games" style="color:#053458">Recharger la liste des jeux</a></div>
{% if cancreategames %}
<fieldset class="fieldset" ><legend style="font-size:25px;">Ajouter un jeu</legend>
<button id="add" onclick="javascript:go('/add_game')">
@ -15,7 +16,6 @@
{% endif %}
{% if mesjeux|length > 0 %}
<fieldset class="fieldset" ><legend style="font-size:25px;">Mes jeux</legend>
<div style="width:100%;text-align:right;padding-bottom:10px;"><a href="/games" style="color:blue">Recharger la liste des jeux</a></div>
<table class="tablelist">
{% for g in mesjeux %}
<tr>