{% load thumbnail %}
{% load gravatar %}
{% load ranks %}

{# Forum userview #}
{% if userprofile %}
  {% if userprofile.avatar %}
    {% thumbnail userprofile.avatar "100x100" crop="center" as im %}
      <p><img src="{{ im.url }}" width="{{ settings.GRAVATAR_DEFAULT_SIZE }}" height="{{ settings.GRAVATAR_DEFAULT_SIZE }}" alt="{{ userprofile.user.username }}" class="forumprofile" /></p>
    {% endthumbnail %}
  {% else %}<p>{% gravatar userprofile.user.email %}</p>
  {% endif %}
  {% if userprofile.user.username %}<p><a href="{% url app_forum-userprofile userprofile.user.username %}">{{ userprofile.user.username }}</a></p>{% endif %}
  {% if userprofile.signature %}<p>{{ userprofile.signature }}</p>{% endif %}
  {% if userprofile.user.posts %}
    <p>{{ userprofile.user.posts.count }} {{ _('posts') }}</p>
    <p>{% rank userprofile.user.username userprofile.user.posts.count %}</p>
  {% endif %}
{% endif %}

{# Forum lists #}
{% if post.user %}
  {% if post.user.profile.all.0.avatar %}
    {% thumbnail post.user.profile.all.0.avatar "100x100" crop="center" as im %}
      <p><img src="{{ im.url }}" width="{{ settings.GRAVATAR_DEFAULT_SIZE }}" height="{{ settings.GRAVATAR_DEFAULT_SIZE }}" alt="{{ post.user.username }}" class="forumprofile" /></p>
    {% endthumbnail %}
  {% else %}<p>{% gravatar post.user.email %}</p>
  {% endif %}
  {% if post.user.username %}<p><a href="{% url app_forum-userprofile post.user.username %}">{{ post.user.username }}</a></p>{% endif %}
  {% if post.user.profile.all.0.signature %}<p>{{ post.user.profile.all.0.signature }}</p>{% endif %}
  {% if post.user.posts %}
    <p>{{ post.user.posts.count }} {{ _('posts') }}</p>
    <p>{% rank post.user.username post.user.posts.count %}</p>
  {% endif %}
{% endif %}

