Add links to player column in tables
This commit is contained in:
parent
20a74a0207
commit
cd3c4190b2
3 changed files with 9 additions and 3 deletions
|
@ -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)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
render_leaderboard()
|
||||
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue