{% load spirit_tags i18n %}

<div class="profile__img">
  <img
    class="profile__img__avatar"
    src="{% get_gravatar_url user=p_user size=200 %}" />
  <div class="profile__img__username">{{ p_user.st.nickname }}</div>
</div>

<div class="profile__info">
  {% spaceless %}
    <ul>
      <li>
        <div class="profile__info__title">{% trans "Joined at" %}</div>
        <div class="profile__info__date">{{ p_user.date_joined|shortnaturaltime }}</div>
      </li>
      <li>
        <div class="profile__info__title">{% trans "Seen" %}</div>
        <div class="profile__info__date">{{ p_user.st.last_seen|shortnaturaltime }}</div>
      </li>
      {% if user.st.is_administrator %}
        <li>
          <div class="profile__info__title">{% trans "Last IP" %}</div>
          <div class="profile__info__date">{{ p_user.st.last_ip }}</div>
        </li>
      {% endif %}
    </ul>
  {% endspaceless %}
</div>

{% ifequal user.username p_user.username %}
  <div class="profile__profile_preferences">
    <a
      class="button"
      href="{% url "spirit:user:update" %}"
    ><i class="fa fa-cog"></i> {% trans "Preferences" %}</a>
  </div>
  {% else %}
  <div class="profile__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__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="nav__tabs">
    <li><a
      class="nav__tabs__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="nav__tabs__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="nav__tabs__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 %}
