{% extends theme("user/profile_layout.html") %}
{% from theme('macros.html') import render_pagination, topic_pages %}

{% block breadcrumb %}
<ul class="breadcrumb flaskbb-breadcrumb">
    <li><a href="{{ url_for('forum.index') }}">{% trans %}Forum{% endtrans %}</a></li>
    <li><a href="{{ user.url }}">{{ user.username }}</a></li>
    <li class="active">{% trans %}Posts{% endtrans %}</li>
</ul>
{% endblock %}

{% block profile_navigation %}
<ul class="nav profile-sidenav" id="profile-tabs" role="tablist">
    <li>
        <a href="{{ user.url }}">
            <span class="fa fa-home"></span> {% trans %}Overview{% endtrans %}
        </a>
    </li>
    {#
    <li>
        <a href="{{ user.url }}">
            <span class="fa fa-line-chart"></span> {% trans %}Statistics{% endtrans %}
        </a>
    </li>
    #}
    <li>
        <a href="{{ url_for('user.view_all_topics', username=user.username) }}">
            <span class="fa fa-comments"></span> {% trans %}Topics{% endtrans %}
        </a>
    </li>

    <li class="active">
        <a href="{{ url_for('user.view_all_posts', username=user.username) }}">
            <span class="fa fa-comment"></span> {% trans %}Posts{% endtrans %}
        </a>
    </li>
</ul>
{% endblock %}


{% block profile_content %}
<!-- middle column -->
<div class="col-md-9 col-sm-9 col-xs-12 profile-content">

    {% for post in posts.items %}
    <div class="panel page-panel">
        <div class="panel-heading page-head">
            <a href="{{ post.topic.url }}">{{ post.topic.title }}</a>
        </div>
        <div class="panel-body page-body topic-content">
            <div class="col-md-12 col-sm-12 col-xs-12">
                <div class="topic-created">
                    {{ post.date_created|format_date('%d %B %Y - %H:%M') }}
                </div>
                <div class="topic-content">
                    {{ post.content|markup }}
                </div>
            </div>
        </div>
    </div>
    {% else %}
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="alert-message alert-message-info" role="alert">
                {% trans %}The user has not written any posts yet.{% endtrans %}
            </div>
        </div>
    </div>
    {% endfor %}

    {% if posts.items|length > 1 %}
    <div class="col-md-12 col-sm-12 col-xs-12 controls-col">
        <div class="pull-left">
            {{ render_pagination(posts, url_for('user.view_all_posts', username=user.username)) }}
        </div>
    </div>
    {% endif %}

</div>
{% endblock %}
