{% macro rank_users(rank, limit=None) -%} {%- set users = rank.users | list -%} {%- for user in (users if limit is none else users[:limit]) -%} {{ user.username }}{% if not loop.last %}, {% endif %} {%- endfor -%} {%- if limit is not none and users | length > limit %}, {% trans %}more{% endtrans %}{% endif -%} {%- endmacro %} {% macro rank_block(title, ranks, hide_unapplied, name_placeholder, code_placeholder, show_requirement) %} {%- set show_users = rank_setting("SHOW_USERS") -%}
{% trans %}Name{% endtrans %}
{% trans %}Rank{% endtrans %}
{% if show_requirement %}
{% trans %}Posts{% endtrans %}
{% endif %} {% if show_users %}
{% trans %}Users{% endtrans %}
{% endif %}
{% for rank in ranks %}
{% if hide_unapplied and not rank.users %}
{{ name_placeholder }}
{{ code_placeholder|nonpost_markup }}
{% if show_requirement %}
{{ rank_setting("REQUIREMENT_PLACEHOLDER") or rank.requirement }}
{% endif %} {% if show_users %}
{% endif %} {% else %}
{{ rank.rank_code|nonpost_markup }}
{% if show_requirement %}
{{ rank.requirement }}
{% endif %} {% if show_users %}
{{ rank_users(rank, rank_setting("HOW_MANY_USERS")) }}
{% endif %} {% endif %}
{% else %}
{% trans %}No ranks found.{% endtrans %}
{% endfor %}
{% endmacro %}