{% extends "mahjong_ranking/page.html" %}
{% load i18n thumbnail %}

{% block title %}{% trans 'Player List' %}{% endblock %}
{% block extra_head %}
<link rel="canonical" href="{% url 'kyudanranking-list' %}?page={{page_obj.number}}" />
{% endblock %}

{% block teaser %}<h1>{% trans 'Player List' %}</h1>{% endblock %}

{% block redbox %}{% include 'mahjong_ranking/ladder_redbox.html' %}{% endblock %}

{% block content %}
<table>
 <thead>
  <tr>
   <th>{% trans 'Avatar' %}</th>
   <th>
   <a href="{% url 'kyudanranking-list' order_by='+username' %}?page={{page_obj.number}}" class="fa fa-sort-asc" rel="nofollow"></a>
   {% trans 'Nickname' %}
   <a href="{% url 'kyudanranking-list' order_by='-username' %}?page={{page_obj.number}}" class="fa fa-sort-desc" rel="nofollow"></a>
   </th>
   <th>
    <a href="{% url 'kyudanranking-list' order_by='+full_name'%}?page={{page_obj.number}}" class="fa fa-sort-asc" rel="nofollow"></a>
    {% trans 'Full Name' %}
    <a href="{% url 'kyudanranking-list' order_by='-full_name' %}?page={{page_obj.number}}" class="fa fa-sort-desc" rel="nofollow"></a>
   </th>
   <th>
    <a href="{% url 'kyudanranking-list' order_by='+rank' %}?page={{page_obj.number}}" class="fa fa-sort-asc" rel="nofollow"></a>
    {% trans 'Rank' %}
    <a href="{% url 'kyudanranking-list' order_by='-rank' %}?page={{page_obj.number}}"  class="fa fa-sort-desc" rel="nofollow"></a>
   </th>
   <th>
    <a href="{% url 'kyudanranking-list' order_by='+score' %}?page={{page_obj.number}}" class="fa fa-sort-asc" rel="nofollow"></a>
    {% trans 'Score' %}
    <a href="{% url 'kyudanranking-list' order_by='-score' %}?page={{page_obj.number}}" class="fa fa-sort-desc" rel="nofollow"></a>
   </th>
   <th>
    <a href="{% url 'kyudanranking-list' order_by='+hanchan_count'%}?page={{page_obj.number}}" class="fa fa-sort-asc" rel="nofollow"></a>
    {% trans 'Games Total' %}
    <a href="{% url 'kyudanranking-list' order_by='-hanchan_count'%}?page={{page_obj.number}}" class="fa fa-sort-desc" rel="nofollow"></a>
   </th>
  </tr>
 </thead>
 <tbody>
 {% for ranking in kyudanranking_list %}
  <tr>
   <td>
    <a href="{{ ranking.get_absolute_url }}"><img
       src="{% thumbnail ranking.user.avatar|default:'unknown_profile.jpg' 'avatar' %}"
       width="70" height="70" alt="" /></a>
   </td>
   <td><a href="{{ ranking.get_absolute_url }}">{{ ranking.user }}</a></td>
   <td>{% if user.is_authenticated %}{{ranking.user.last_name}} {{ranking.user.first_name}}{% else %}---{% endif %}</td>
   <td>{% if ranking.dan %} {{ranking.dan}}. Dan {% else %} {{ranking.kyu}} Kyu {% endif %}</td>
   <td class="right">{% if ranking.dan %} {{ranking.dan_points}} {% else %} {{ranking.kyu_points}} {% endif %}</td>
   <td class="right">{{ranking.hanchan_count}}</td>
  </tr>
{% endfor %}
 </tbody>
</table>
{% endblock %}