{% extends "planet/base.html" %}
{% load i18n pagination_tags tagging_tags planet_tags %}
{% load url from future %}

{% block head_title %}{{ author.name }}{% endblock %}

{% block extra_head %}
    <meta name="title" content="{{ author.name }}" />
    <meta name="description" content="{{ author.name }}: blogs and posts about django-related stuff" />
    <meta name="robots" content="index, follow" />
    <link rel="canonical" href="http://{{ site.domain }}{{ author.get_absolute_url }}"/>
{% endblock %}

{% block breadcrumb_section %}
    <li><a href="{% url 'planet.views.authors_list' %}">{% trans "Authors" %}</a> <span class="divider">/</span></li>
    {% if tag %}
        <li><a href="{{ author.get_absolute_url }}">{{ author.name }}</a> <span class="divider">/</span></li>
    {% endif %}
{% endblock %}
{% block breadcrumb_detail %}
    {% if tag %}
        <li class="active">{% trans "Tagged" %}: {{ tag.name }}</li>
    {% else %}
        <li class="active">{{ author.name }}</li>
        {% endif %}
{% endblock %}

{% block head_feeds %}
    <link rel="alternate" type="application/rss+xml"
      title="{% blocktrans with author_name=author.name site_name=site.name  %} blog by {{ author_name }} in {{ site_name }} - RSS 2.0 Feed{% endblocktrans %}"
      href="{% url 'planet_author_rss_feed' author.pk %}" />
{% endblock %}

{% block rss_feed %}
    <a href="{% url 'planet_author_rss_feed' author.pk %}"
      title="{% blocktrans with author_name=author.name %}Suscribe to RSS feed for {{ author_name }}'s blog{% endblocktrans %}">
        <img src="{{ MEDIA_URL }}images/rss20.png" alt="RSS 2.0 Feed"/>
    </a>
{% endblock %}

{% block content %}
    <h1>{{ author.name }}</h1>
    <table class="author details table table-hover table-bordered">
        {% for blog in author|get_blogs %}
        <tr>
          <th>{% trans 'Blog Info' %}</th>
          <td><a href="{{ blog.get_absolute_url }}">{{ blog.title }}</a></td>
        </tr>
        {% endfor %}
        {% for blog in author|get_blogs %}
        <tr>
          <th>{% trans 'Blog website' %}</th>
          <td><a href="{{ blog.url }}">{% trans 'Link' %}</a></td>
        </tr>
        {% endfor %}
        <tr>
          <th>{% trans 'Stats' %}</th>
          <td>{% blocktrans with author_posts=author|post_count %}Has written {{ author_posts }} posts about or related to Django{% endblocktrans %}</td>
        </tr>
    </table>

    {% if tag %}
        <div>
            <p>{% trans 'Posts under tag' %}: <strong>{{ tag|safe }}</strong></p>
            <a href="{{ author.get_absolute_url }}" title="{% trans 'See all posts by' %} {{ author.name }}">
                {% trans 'See the complete list of posts by this author' %}
            </a>
        </div>
    {% endif %}

    {% autopaginate posts 20 %}
    {% for post in posts %}
        <div class="post short {% cycle 'even' 'odd' %} clearfix">
          {% post_details post "planet/posts/short.html" %}
        </div>
    {% endfor %}
    {% paginate %}
{% endblock %}

{% block right_column %}
    {% if tag %}
        <div>
            {% authors_about tag %}
        </div>
    {% endif %}

    {% cloud_for_author author %}
{% endblock %}
