{% extends "users/base.html" %}

{% load markup cache timesince_filters %}

{% block extra_title %}
  {{ block.super }}: {{ user.display_name }}
{% endblock%}

{% block description %}{{ site.name }} Community: {{ user.display_name }} Profile{% endblock %}

{% block canonical %}
  <link rel="canonical" href="{% url 'view_profile' user.username %}">
{% endblock %}

{% block content %}
  <article>
    <img src="{{ MEDIA_URL }}{% firstof user.avatar 'img/avatars/default.jpg' %}" class="left noscale">
    {% if authenticated_request %}
      <h2 class="meta button right">
        {% if user = request.user %}
          <a href='{% url 'edit_profile' %}' class="edit">✎ Edit profile</a>
        {% else %}
          <a href="{% url 'contact_member' user.username %}">
            <span class="embiggen_text">✉</span> Send a message
          </a>
        {% endif %}
      </h2>
    {% endif %}
    <h1>{{ user.display_name }}</h1>
    <dl class="clear">
      {% if user.bio %}
        <dt>About</dt>
        <dd>{{ user.bio|markdown }}</dd>
      {% endif %}
      <dt>Member since:</dt>
      <dd>{{ user.date_joined|date:"M j, Y"}}</dd>
      {% if user.gender %}
          <dt>Gender:</dt>
          <dd> {{ user.get_gender_display }}</dd>
      {% endif %}
      {% if user.birthday %}
          <dt>Age:</dt>
          <dd>{{ user.birthday|short_timesince }}</dd>
      {% endif %}
      {% if user.homepage %}
          <dt>Homepage:</dt>
          <dd><a href="{{ user.homepage }}">{{ user.homepage }}</a></dd>
      {% endif %}
      {% if user.city or user.state or user.country %}
          <dt>Location:</dt>
          <dd>
            {% if user.city %}{{ user.city }}, {% endif %}
            {{ user.state }}
            {% if user.country %}{{ user.country }}{% endif %}
          </dd>
      {% endif %}
      {% if user.occupation %}
          <dt>Occupation:</dt>
          <dd>{{ user.occupation }}</dd>
      {% endif %}
      {% if user.interests %}
          <dt>Interests:</dt>
          <dd>{{ user.interests }}</dd>
      {% endif %}
    </dl>
  </article>
{% endblock %}
