From cd3c4190b2e9c77a728de4a43555d081aeadbf83 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20Ke=C3=9Fler?= Date: Sun, 10 Dec 2023 12:04:31 +0100 Subject: [PATCH] Add links to player column in tables --- src/render_site.py | 5 ++++- templates/main.html | 2 +- templates/stats_table.html | 5 ++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/render_site.py b/src/render_site.py index 9ab6081..3ae60b3 100644 --- a/src/render_site.py +++ b/src/render_site.py @@ -460,4 +460,7 @@ def render_leaderboard(): shutil.copytree('deps/tabulator/dist/css', 'build/css', dirs_exist_ok=True) shutil.copytree('deps/tabulator/dist/js', 'build/js', dirs_exist_ok=True) -render_leaderboard() + +if __name__ == "__main__": + render_leaderboard() + diff --git a/templates/main.html b/templates/main.html index 77abdcc..c1593c1 100644 --- a/templates/main.html +++ b/templates/main.html @@ -118,7 +118,7 @@ {% for variant in variants_with_player_nums %} - {{ variant.name }} + {{ variant.name }} {{ variant.num_players }} {{ variant.stats.rating | int }} {{ variant.stats.games_played }} diff --git a/templates/stats_table.html b/templates/stats_table.html index fbcdea2..4dd8d17 100644 --- a/templates/stats_table.html +++ b/templates/stats_table.html @@ -71,7 +71,10 @@ var table_{{div_id}} = new Tabulator("#table-{{div_id}}", { {title: "Rating Change", field: "variant_rating_change"}, {title: "Rating After", field: "variant_rating_after"}, {% endif %} - {title: "Players", field: "users"}, + {title: "Players", field: "users", formatter:function(cell, formatterParams, onRendered) { + let links = cell.getValue().map(player => `${player}`); + return links.join(", "); + }}, {title: "Seed", field: "seed", formatter: "link", formatterParams: { urlPrefix: "https://hanab.live/seed/", target:"_blank"