From 76e7c92d9b60508fed1bf9eeafa0110d408116bf Mon Sep 17 00:00:00 2001 From: Leo VIALLON-GALINIER Date: Fri, 8 May 2020 22:24:21 +0200 Subject: [PATCH] Add page for game see --- belote.py | 3 ++- templates/game_see.html | 45 +++++++++++++++++++++++++++++++++++++++++ templates/games.html | 2 +- 3 files changed, 48 insertions(+), 2 deletions(-) create mode 100644 templates/game_see.html diff --git a/belote.py b/belote.py index 1794312..eaad8a4 100644 --- a/belote.py +++ b/belote.py @@ -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']) diff --git a/templates/game_see.html b/templates/game_see.html new file mode 100644 index 0000000..25779d6 --- /dev/null +++ b/templates/game_see.html @@ -0,0 +1,45 @@ +{% extends "base.html" %} + +{% block title %} Jeu {% endblock %} + +{% block titre %} Jeu {{ game.name }} {% endblock %} + + +{% block contenu %} +
+
Table +

Admin : {{ game.admin }}

+

Nombre de parties : {% if game.turn <= -8 %}{{ game.partie - 1 }}{% else %}{{ game.partie }}{% endif %}

+ {% if game.start %} + {{lp}} + + + + + + + + +
ÉquipesPoints
    +
  • {{ serialized['playersinfo'][serialized['players'][0]] }} ({{ serialized['players'][0] }}) +
  • {{ serialized['playersinfo'][serialized['players'][2]] }} ({{ serialized['players'][2] }}) +
{{ game.cumul_0 }}
    +
  • {{ serialized['playersinfo'][serialized['players'][1]] }} ({{ serialized['players'][1] }}) +
  • {{ serialized['playersinfo'][serialized['players'][3]] }} ({{ serialized['players'][3] }}) +
{{ game.cumul_1 }}
+ {% endif %} +
+ {% if game.start %} +
Partie en cours +

Tour : {{ serialized['turn'] }}

+

Atout : {% if serialized['atout'] is none %} - {% else %}{{ serialized['atout'] }}{% endif %}

+

Pris par : {% if serialized['preneur'] is none %} - {% else %}{{ serialized['playersinfo'][serialized['preneur']] }} ({{ serialized['preneur'] }}){% endif %}

+

Cartes jouées : {{ serialized['played'] }}

+ {% set pj = (serialized['first_player'] + game.turn) % 4 %} +

Prochain joueur : {{ serialized['playersinfo'][serialized['players'][pj]] }} ({{ serialized['players'][pj] }})

+
+ {% endif %} +
+ +{% endblock %} + diff --git a/templates/games.html b/templates/games.html index f7db75f..6380572 100644 --- a/templates/games.html +++ b/templates/games.html @@ -6,6 +6,7 @@ {% block contenu %}
+
Recharger la liste des jeux
{% if cancreategames %}
Ajouter un jeu