{% extends "cranefly/layout.html" %}
{% import "cranefly/macros.html" as macros with context %}

{% block title %}{{ macros.page_title(profile.username) }}{% endblock %}

{% block container %}
<div class="user-profile{% if profile.get_style() %} user-profile-{{ profile.get_style() }}{% endif %}">
  <div class="page-header header-primary user-profile-header">
    <div class="container">
      {{ messages_list(messages) }}
      <div class="header-row">
        {% if profile.id == user.id and not user.avatar_ban %}
        <a href="{% url 'usercp_avatar' %}"><img src="{{ profile.get_avatar() }}" class="header-avatar tooltip-right" title="{% trans %}Click to jump to your Avatar Settings{% endtrans %}"></a>
        {% else %}
        <img src="{{ profile.get_avatar() }}" class="header-avatar">
        {% endif %}
        <div class="header-side">
          <h1>{{ profile.username }} <small>{% if profile.title or profile.rank.title -%}
            <strong>{% if profile.title %}{{ _(profile.title) }}{% elif profile.rank.title %}{{ _(profile.rank.title) }}{% endif %}</strong>; {% endif %}
            {%- if online and (not hidden or acl.users.can_see_hidden_users()) -%}
            {%- if profile.hide_activity -%}
              {% trans %}Online, hidden{% endtrans %}
            {%- else -%}
              {% trans %}Online{% endtrans %}
            {%- endif %}
            {%- else -%}
              {% trans %}Offline{% endtrans %}
            {%- endif -%}, {% if not hidden or acl.users.can_see_hidden_users() -%}
              {%- if online -%}
                {% trans last_click=online.last|reltimesince|low %}last click {{ last_click }}{% endtrans %}
              {%- elif profile.last_date -%}
                {% trans last_visit=profile.last_date|reltimesince|low %}last seen {{ last_visit }}{% endtrans %}
              {%- else -%}
                {% trans %}never visited{% endtrans %}
              {%- endif -%}
            {%- else -%}
              {% trans %}hiding activity{% endtrans %}
            {%- endif %}</small></h1>
          <ul class="nav nav-tabs header-tabs">
            {% for link in tabs %}
            <li{% if link.active %} class="active"{% endif %}>
              <a href="{{ link.route|url(user=profile.pk, username=profile.username_slug) }}">{{ link.name }}</a>
            </li>
            {% endfor %}
            {% if user.is_authenticated() and user.pk != profile.pk %}
            <li class="pull-right">
              <form class="form-inline" action="{% if ignores %}{% url 'unignore_user' user=profile.id %}{% else %}{% url 'ignore_user' user=profile.id %}{% endif %}" method="post">
                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
                <input type="hidden" name="fallback" value="{{ fallback }}">
                <button type="submit" class="btn tooltip-top{% if ignores %} btn-inverse{% endif %}" title="{% if ignores %}{% trans user=profile.username %}Remove {{ user }} from ignored{% endtrans %}{% else %}{% trans user=profile.username %}Add {{ user }} to ignored{% endtrans %}{% endif %}">
                  <i class="icon-ban-circle"></i>
                </button>
              </form>
            </li>
            <li class="pull-right">
              <form class="form-inline" action="{% if follows %}{% url 'unfollow_user' user=profile.id %}{% else %}{% url 'follow_user' user=profile.id %}{% endif %}" method="post">
                <input type="hidden" name="{{ csrf_id }}" value="{{ csrf_token }}">
                <input type="hidden" name="fallback" value="{{ fallback }}">
                <button type="submit" class="btn tooltip-top{% if follows %} btn-success{% endif %}" title="{% if follows %}{% trans user=profile.username %}Stop following {{ user }}{% endtrans %}{% else %}{% trans user=profile.username %}Start following {{ user }}{% endtrans %}{% endif %}">
                  <i class="icon-heart"></i>
                </button>
              </form>
            </li>
            {% if acl.private_threads.can_start() %}
            <li class="pull-right">
              <a href="{% url 'private_thread_start_with' username=profile.username_slug, user=profile.pk %}" class="btn tooltip-top" title="{% trans user=profile.username %}Start private thread with {{ user }}{% endtrans %}"><i class="icon-envelope"></i></a>
            </li>
            {% endif %}
            {% endif %}
          </ul>
        </div>
      </div>
    </div>
  </div>
  <div class="container container-primary">
    {% block tab %}{% endblock %}
  </div>
</div>
{% endblock %}