{% extends "events/event_detail.html" %}
{% load i18n humanize thumbnail %}

{% block title %}{% trans 'Mai-Star Games' %} - {{ event.name }}{% endblock %}

{% block maincontent %}
<h2 class="grid_12">{% trans 'Played Mai-Star Games' %}</h2>

{% for game in game_list %}
<article id="{{ game.pk }}">
    <h3 class="grid_12">{{ forloop.counter|ordinal }} {% trans 'Game' %}</h3>
    {% for player in game.player_list %}
    <div class="grid_2 center">
        <h4>{{ player.placement|ordinal }} {% trans 'Place' %}</h4>
        <a class="avatar player" href="{% url 'maistar-player-games' username=player.user.username season=game.season %}"><img
                src="{% thumbnail player.user.avatar|default:'unknown_profile.jpg' 'avatar' %}"
                width="70" height="70" alt=""/></a>
        <p><a href="{% url 'maistar-player-games' username=player.user.username season=game.season %}">{{player.user.username}}</a><br/>
        {{player.score}} {% trans 'Points' %}</p>
    </div>
    {% endfor %}
    <div class="grid_12 more_link">
        {% if perms.maistar_ranking.delete_dame %}
        <a class="button" href="{% url 'maistar-delete-game' game.pk %}"><span class="fa fa-trash"></span> {% trans 'Delete Game' %}</a>
        {% endif %}
        {% if perms.maistar_ranking.change_game %}
        <a class="button" href="{% url 'maistar-edit-game' game.pk %}"><span class="fa fa-pencil"></span> {% trans 'Edit Game' %}</a>
        {% endif %}
    </div>

</article>
{% empty %}
<p class="grid_12">{% trans 'No Mai-Star games have been added to this event yet.'%}</p>
{% endfor %}
<p>&nbsp;</p>
{% endblock %}

{% block buttonbar %}
{% if perms.maistar_ranking.add_game %}
<a class="button" href="{{event.get_edit_url}}"><span class="fa fa-pencil"></span> {% trans 'Edit Event' %}</a>
<a class="button" href="{% url 'maistar-add-game' event.id %}"><span class="fa fa-plus-circle"></span> {% trans 'Add Game' %}</a>
{% endif %}
{% endblock %}