{%- from theme("macros.html") import sidebar with context -%}
{% extends theme("layout.html") %}
{% set page_title = _("%(user)s - User", user=user.username) %}

{% block content %}

{% block breadcrumb %}
{% endblock %}

<div class="page-view">
    <div class="row">
        <div class="col-md-12 col-sm-12 col-xs-12">
            <div class="panel page-panel">
                <div class="panel-heading page-head">
                    <a href="{{ user.url }}">{{ user.username }}</a>
                    {% if current_user|can_edit_user %}
                    <a class="btn btn-xs btn-default pull-right" href="{{ url_for('management.edit_user', user_id=user.id)}}"><i class="fa fa-pencil"></i> {% trans %}Edit{% endtrans %}</a>
                    {% endif %}
                </div>
                <div class="panel-body page-body profile-body">
                    {% block profile_sidebar %}
                    <div class="col-md-3 col-sm-3 col-xs-12 profile-sidebar">
                        <div class="profile-picture">
                            {% if user.avatar %}
                            <img src="{{ user.avatar }}" alt="{{ user.username }}'s Avatar">
                            {% endif %}
                        </div>

                        <div class="profile-groupname">
                            {{ user.primary_group.name }}
                        </div>

                        <div class="profile-online" data-toggle="tooltip" data-placement="top" title="{%- if user.lastseen -%} {{ user.lastseen|time_since }} {%- else -%} {% trans %}Never seen{% endtrans %} {%- endif -%}">
                            {%- if user|is_online %}
                            <span class="label label-success">{% trans %}online{% endtrans %}</span>
                            {%- else %}
                            <span class="label label-default">{% trans %}offline{% endtrans %}</span>
                            {%- endif %}
                        </div>

                        <div class="profile-sidebar-stats">
                            <div class="profile-posts">
                                {{ user.post_count }} {% trans %}posts{% endtrans %}
                            </div>

                            <div class="profile-date">
                                {{ user.date_joined|format_date }}
                            </div>

                            {{ run_hook("flaskbb_tpl_profile_sidebar_stats", user=user) }}
                        </div>

                    {{ sidebar(
                        run_hook(
                            "flaskbb_tpl_profile_sidebar_links",
                            user=user,
                            is_markup=False
                            ),
                            extra_class="profile-sidebar"
                        )
                    }}
                    </div>
                    {% endblock %}

                    {% block profile_content %}
                    {% endblock %}

                </div> <!-- end profile widget -->
            </div> <!-- end page-panel -->
        </div> <!-- end col -->
    </div> <!-- end row -->
</div> <!-- end page-view -->

{% endblock %} {# content #}
