{% load spirit_tags i18n %}


<div class="profile-img">
  <img class="profile-avatar" src="{% get_gravatar_url user=p_user size=200 %}" />
  <div class="profile-username">{{ p_user.st.nickname }}</div>
</div>

<div class="profile-info">
  {% spaceless %}
    <ul class="profile-track">
      <li>
        <div class="profile-title">{% trans "Joined at" %}</div>
        <div class="profile-date">{{ p_user.date_joined|shortnaturaltime }}</div>
      </li>
      <li>
        <div class="profile-title">{% trans "Seen" %}</div>
        <div class="profile-date">{{ p_user.st.last_seen|shortnaturaltime }}</div>
      </li>

      {% if user.st.is_administrator %}
        <li>
          <div class="profile-title">{% trans "Last IP" %}</div>
          <div class="profile-date">{{ p_user.st.last_ip }}</div>
        </li>
      {% endif %}
    </ul>
  {% endspaceless %}
</div>

{% ifequal user.username p_user.username %}
  <div class="profile-preferences">
    <a class="button"
      href="{% url "spirit:user:update" %}"
    ><i class="fa fa-cog"></i> {% trans "Preferences" %}</a>
  </div>
  {% else %}
  <div class="private-message">
    <a class="button"
      href="{% url "spirit:topic:private:publish" user_id=p_user.pk %}"
    ><i class="fa fa-envelope"></i> {% trans "Private Message" %}</a>
  </div>
{% endifequal %}

{% if user.st.is_administrator %}
  <div class="profile-preferences">
    <a class="button"
      href="{% url "spirit:admin:user:edit" user_id=p_user.pk %}"
    ><i class="fa fa-cog"></i> {% trans "Edit user" %}</a>
  </div>
{% endif %}

{% spaceless %}
  <ul class="tabs">
    <li>
      <a class="tab-link{% ifequal active_tab 0 %} is-selected{% endifequal %}"
        href="{% url "spirit:user:detail" pk=p_user.pk slug=p_user.st.slug %}"
      >{% trans "Comments" %}</a>
    </li>
    <li>
      <a class="tab-link{% ifequal active_tab 1 %} is-selected{% endifequal %}"
        href="{% url "spirit:user:topics" pk=p_user.pk slug=p_user.st.slug %}"
      >{% trans "Topics" %}</a>
    </li>
    <li>
      <a class="tab-link{% ifequal active_tab 2 %} is-selected{% endifequal %}"
        href="{% url "spirit:user:likes" pk=p_user.pk slug=p_user.st.slug %}"
      >{% trans "Likes" %}</a>
    </li>
  </ul>
{% endspaceless %}
