forked from Hanabi/hanabi-league
simplify: use jinja macro
This commit is contained in:
parent
89a14b6bc1
commit
c9c4e3aec6
2 changed files with 8 additions and 9 deletions
|
@ -1,3 +1,4 @@
|
|||
{% macro stats_list(stats, show_rating) %}
|
||||
<!-- Table for statistics of a variant -->
|
||||
<div class="history-bullets">
|
||||
<ul class="stat-list">
|
||||
|
@ -48,4 +49,5 @@
|
|||
{{stats.average_moves}}
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
{% endmacro %}}
|
|
@ -1,4 +1,5 @@
|
|||
{% extends "layout.html" %}
|
||||
{% from "stats_table.html" import stats_list %}
|
||||
|
||||
{% block navbar %}
|
||||
<nav class="navbar navbar-expand-lg navbar-light bg-light">
|
||||
|
@ -31,25 +32,21 @@
|
|||
<h3>
|
||||
League Statistics for {{variant_name}}
|
||||
</h3>
|
||||
{% with stats=variant_stats, show_rating=False %}
|
||||
{% include "stats_table.html" %}
|
||||
{% endwith %}
|
||||
{{ stats_list(variant_stats, False) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{% for num_players, stats in variant_stats_by_player.items() %}
|
||||
{% for num_players, num_player_stats in variant_stats_by_player.items() %}
|
||||
<div class="tab-pane fade" id="stats-{{num_players}}p">
|
||||
<div class="container my-5">
|
||||
<h3>
|
||||
League Statistics for {{variant_name}} - {{num_players}} Players
|
||||
</h3>
|
||||
{% with show_rating=True %}
|
||||
{% include "stats_table.html" %}
|
||||
{% endwith %}
|
||||
{{ stats_list(num_player_stats, True) }}
|
||||
<h4>
|
||||
List of Played Games
|
||||
</h4>
|
||||
{% if stats.games_played == 0 %}
|
||||
{% if num_player_stats.games_played == 0 %}
|
||||
There have been no games played on this variant with {{num_players}} players so far.
|
||||
{% else %}
|
||||
<div id="table-{{num_players}}p"></div>
|
||||
|
|
Loading…
Reference in a new issue