{% extends "base.html" %}
{% set name = player['displayName'] or player['name'] %}
{% set imageUrl = player['imageUrl'] %}
{% set ratings = player['ratings'] %}

{% block title %}{{name}} - {{super()}}{% endblock %}
{% block body_class %}player{% endblock %}

{% block content %}
    <p class="nav">
        <a href="/">Home</a>
    </p>

    <h1>{{name}}</h1>

    {% if imageUrl %}
        <img class="player-image" src="{{imageUrl}}">
    {% endif %}

    <h2>Ratings</h2>
    <table>
        <tr>
            <th>Game</th>
            <th>Rating</th>
            <th>Position</th>
        </tr>
        {% for game, game_name, rating, placement in ratings %}
            <tr>
                <td class="name"><a href="/{{game}}">{{game_name}}</a></td>
                <td class="number">{{rating | int}}</td>
                <td class="position">{{placement + 1}}</td>
            </tr>
        {% endfor %}
    </table>


{% endblock %}
