{# Macro for rendering a single top poster card #} {% macro poster_card(poster, rank, podium_class) %}
{{ poster.USER_AVATAR }}
{{ poster.USER_FULL }}
{{ poster.TOTAL_POSTS }} {{ poster.PERCENTAGE }}
{% if podium_class in ['gold', 'silver', 'bronze'] %}
{{ rank }}
{% else %}
#{{ rank }}
{% endif %}
{% endmacro %} {# Cache language strings #} {% set lang_no_top_poster = lang('NO_TOP_POSTER') %} {% set lang_go = lang('GO') %} {% set lang_select_month = lang('SELECT_MONTH') %} {% set lang_previous = lang('PREVIOUS') %} {% set lang_next = lang('NEXT') %} {% INCLUDE 'overall_header.html' %}
{% if not DISABLE_MONTH_PREV %} {% else %} {{ lang('PREVIOUS') }} {% endif %}
{% if not DISABLE_MONTH_NEXT %} {% else %} {{ lang('NEXT') }} {% endif %}
{# Selected Month Display #} {% if TSTTM_NUMBERTP > 0 %} {% set posters_selected = top_posters_selected %} {% set count_selected = posters_selected|length %}

{% if SUPPRESS_LAST_MONTH_BLOCK %}{{ lang('TS_TOP_POSTERS_FOR', '' ~ MONTH_LABEL ~ '') }}{% else %}{{ lang('TM_TOP_POSTERS') }}{% endif %}

{% if count_selected > 0 %}
{# Silver (2nd place) #} {% if posters_selected[1] is defined %} {{ _self.poster_card(posters_selected[1], 2, 'silver') }} {% endif %} {# Gold (1st place) #} {% if posters_selected[0] is defined %} {{ _self.poster_card(posters_selected[0], 1, 'gold') }} {% else %}

{{ lang_no_top_poster }}

{% endif %} {# Bronze (3rd place) #} {% if posters_selected[2] is defined %} {{ _self.poster_card(posters_selected[2], 3, 'bronze') }} {% endif %}
{# Remaining posters (4+) #} {% if count_selected > 3 %}
{% for poster in posters_selected|slice(3) %} {{ _self.poster_card(poster, loop.index + 3, 'rest') }} {% endfor %}
{% endif %} {% else %}

{{ lang_no_top_poster }}

{% endif %}
{% endif %} {# Last Month Display (only when not viewing specific month) #} {% if TSTLM_NUMBERTP > 0 and not SUPPRESS_LAST_MONTH_BLOCK %} {% set posters_last = top_posters_last_month %} {% set count_last = posters_last|length %}

{{ lang('LM_TOP_POSTERS') }}

{% if count_last > 0 %}
{# Silver (2nd place) #} {% if posters_last[1] is defined %} {{ _self.poster_card(posters_last[1], 2, 'silver') }} {% endif %} {# Gold (1st place) #} {% if posters_last[0] is defined %} {{ _self.poster_card(posters_last[0], 1, 'gold') }} {% else %}

{{ lang_no_top_poster }}

{% endif %} {# Bronze (3rd place) #} {% if posters_last[2] is defined %} {{ _self.poster_card(posters_last[2], 3, 'bronze') }} {% endif %}
{# Remaining posters (4+) #} {% if count_last > 3 %}
{% for poster in posters_last|slice(3) %} {{ _self.poster_card(poster, loop.index + 3, 'rest') }} {% endfor %}
{% endif %} {% else %}

{{ lang_no_top_poster }}

{% endif %}
{% endif %} {% INCLUDE 'overall_footer.html' %}