{% extends request.ajax ? "layout_blank.phtml" : "layout_default.phtml" %}
{% import "macro_functions.phtml" as mf %}
{% block meta_title %}{% trans 'Forum members' %}{% endblock %}
{% block breadcrumb %}<li class="active">{% trans 'Forum members' %}</li>{% endblock %}

{% block content %}
<div class="row">
    <article class="span12 data-block" role="main">
        <div class="data-container">
            <header>
                <h1>{% trans 'Forum members' %}</h1>
                <p>{% trans 'List of all forum members. You can filter the list by clicking on letter above to find usernames which start with this letter.' %}</p>
            </header>
            <section>
                <div class="pagination">
                    <ul>
                        <li {% if not request.first_char%}class="active"{% endif %}>
                        <a href="{{'forum/members-list'|link}}">{% trans 'All' %}</a>
                        </li>
                        {% for i in range('a', 'z') %}
                        <li {% if request.first_char == i %}class="active"{% endif %}>
                        <a href="{{'forum/members-list'|link({'first_char' : i })}}#memberlist">{{ i|upper }}</a>
                        </li>
                        {% endfor %}
                    </ul>
                </div>

                <table id="memberlist" class="table table-striped table-bordered table-condensed">
                    <thead>
                    <tr>
                        <th>{% trans 'Username' %}</th>
                        <th>{% trans 'Posts' %}</th>
                        <th>{% trans 'Joined' %}</th>
                    </tr>
                    </thead>

                    <tbody>
                    {% set members = guest.forum_members_list({"per_page":20}|merge(request)) %}
                    {% for member in members.list %}
                    <tr>
                        <td>{{member.name}}</td>
                        <td>{{member.posts}}</td>
                        <td>{{member.created_at|bb_date}}</td>
                    </tr>
                    {% else %}
                    <tr>
                        <td colspan="3"><div class="text-center">{% trans 'The list is empty' %}</div></td>
                    </tr>
                    {% endfor %}
                    </tbody>
                </table>
            </section>
        </div>
    </article>
</div>


{% endblock %}