hanabi-league/templates/variant.html

88 lines
3.3 KiB
HTML
Raw Normal View History

2023-12-05 17:39:33 +01:00
{% extends "layout.html" %}
{% from "stats_table.html" import stats_list, games_table_js %}
2023-12-04 17:52:18 +01:00
2023-12-05 17:39:33 +01:00
{% block navbar %}
2023-12-04 17:52:18 +01:00
<nav class="navbar navbar-expand-lg navbar-light bg-light">
<div class="container">
<a class="navbar-brand" href="/">The Hanabi Pro Hunting League</a><a class="navbar-brand" href="#"><small class="text-muted">- Variant Statistics for {{variant_name}}</small></a>
2023-12-04 17:52:18 +01:00
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a class="nav-link active" id="overview-tab" data-toggle="tab" href="#overview">Overview</a>
</li>
2023-12-05 18:17:06 +01:00
{% for num_players in variant_stats_by_player.keys() %}
2023-12-04 17:52:18 +01:00
<li class="nav-item">
<a class="nav-link" id="stats-{{num_players}}p-tab" data-toggle="tab" href="#stats-{{num_players}}p">{{num_players}} Players</a>
</li>
{% endfor %}
2023-12-07 16:47:25 +01:00
<li class="nav-item">
2023-12-08 22:16:35 +01:00
<a class="nav-link" id="Back" href="/">Back</a>
2023-12-07 16:47:25 +01:00
</li>
2023-12-04 17:52:18 +01:00
</ul>
</div>
</div>
</nav>
2023-12-05 17:39:33 +01:00
{% endblock %}
2023-12-04 17:52:18 +01:00
2023-12-05 17:39:33 +01:00
{% block content %}
2023-12-04 17:52:18 +01:00
<div class="tab-content" id="myTabContent">
2023-12-05 18:17:06 +01:00
<div class="tab-pane fade show active" id="overview">
<div class="container my-5">
<h3>
League Statistics for {{variant_name}}
</h3>
2023-12-10 19:47:07 +01:00
{{ stats_list(variant_stats, False, False) }}
<h4>
List of Played Games
</h4>
{% if variant_stats.games_played == 0 %}
There have been no games played on this variant so far.
{% else %}
<div id="table-overview"></div>
{% endif %}
2023-12-05 18:17:06 +01:00
</div>
</div>
2023-12-05 18:30:15 +01:00
{% for num_players, num_player_stats in variant_stats_by_player.items() %}
2023-12-04 17:52:18 +01:00
<div class="tab-pane fade" id="stats-{{num_players}}p">
<div class="container my-5">
<h3>
League Statistics for {{variant_name}} - {{num_players}} Players
2023-12-04 17:52:18 +01:00
</h3>
2023-12-10 19:47:07 +01:00
{{ stats_list(num_player_stats, True, False) }}
2023-12-05 17:28:55 +01:00
<h4>
List of Played Games
</h4>
2023-12-05 18:30:15 +01:00
{% if num_player_stats.games_played == 0 %}
2023-12-05 17:28:55 +01:00
There have been no games played on this variant with {{num_players}} players so far.
{% endif %}
2023-12-22 20:19:57 +01:00
<div id="table-{{num_players}}"></div>
2023-12-04 17:52:18 +01:00
</div>
</div>
{% endfor %}
</div>
<!-- JavaScript part for the interactive tables -->
<script>
// Tabledata
let tabledata = [
{% for game in variant_games %}
{{- game -}},
{% endfor %}
];
// Main table
{{ games_table_js("tabledata", "overview", True, False, False) }}
{% for num_players in variant_stats_by_player.keys() %}
{{ games_table_js("tabledata", num_players, False, True, False) }}
// Filter table on corresponding page to only display games with corresponding player number
table_{{num_players}}.setFilter("num_players", "=", {{num_players}});
{% endfor %}
</script>
2023-12-05 17:39:33 +01:00
{% endblock %}