{% from '_functions.html' import avatar_thumbnail, badge_thumbnail, pluralize with context %}
{% extends '_base.html' %}

{% block body %}
<div class="page">
  <div class="grid-100">
    <div class="shadow">
      <h1 class="section-header">Rising stars: {{frame}} of {{start_date}} to {{stop_date}}</h1>
      <div class="padded-content">
        <p>Looking for the <a href="{{ url_for('tahrir.leaderboard') }}">all-time leaderboard?</a></p>
        <table>
          {% for person, stats in (user_to_rank.items()|list)[:25] %}
            <tr>
              <td style="width: 20px;">
                  <span class="big-text">#{{stats['rank']}}</span>
              </td>
              <td style="width: 100px;">
                  <small>(#{{person.rank}} all time)</small>
              </td>
              <td style="width: 64px;">{{ avatar_thumbnail(person, 64, 33) }}</td>
              <td>
                <a href="{{ url_for('tahrir.user', user_id=person.nickname or person.id) }}">{{person.nickname}}</a>
                earned <strong>{{ user_to_rank[person]['badges'] }}</strong>
                {{ pluralize("badge", user_to_rank[person]['badges']) }}
                during this period.
              </td>
            </tr>
          {% endfor %}
        </table>
      </div> <!-- End padded content. -->
    </div> <!-- End shadow. -->
  </div>
  <div class="clear spacer"></div>
</div>
{% endblock %}
