Add links to player column in tables

This commit is contained in:
Maximilian Keßler 2023-12-10 12:04:31 +01:00
parent 20a74a0207
commit cd3c4190b2
Signed by: max
GPG key ID: BCC5A619923C0BA5
3 changed files with 9 additions and 3 deletions

View file

@ -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()

View file

@ -118,7 +118,7 @@
<tbody>
{% for variant in variants_with_player_nums %}
<tr>
<td class="text-center"><strong><a href="variant/{{variant.variant_id}}">{{ variant.name }}</a></strong></td>
<td class="text-center"><strong><a href="/variant/{{variant.variant_id}}">{{ variant.name }}</a></strong></td>
<td class="text-center">{{ variant.num_players }}</td>
<td class="text-center variant-rating">{{ variant.stats.rating | int }}</td>
<td class="text-center">{{ variant.stats.games_played }}</td>

View file

@ -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 => `<a href="/player/${player}">${player}</a>`);
return links.join(", ");
}},
{title: "Seed", field: "seed", formatter: "link", formatterParams: {
urlPrefix: "https://hanab.live/seed/",
target:"_blank"