{% extends 'base.html' %}

{% block title %}{{ author.name }}{% endblock %}
{% block description %}{{ author.name }}'s writing at Notes From Below.{% endblock %}
{% block image %}/static/img/favicon-180x180.png{% endblock %}
{% block twittercard %}summary{% endblock %}

{% block content %}
<div class="page-content">
    <div class="ui container">
        {% if request.user.is_staff %}
        <div class="ui center aligned basic segment">
            <a href="{% url 'admin:journal_author_change' author.pk %}"
               class="ui blue icon button">
               <i class="edit icon"></i>
               Edit in admin
            </a>
        </div>
        {% endif %}
        <div class="nfb-content-box">
            <div class="section">
                <h1 class="ui header">
                    {{ author.name }}
                    {% if author.twitter %}(<a href="https://twitter.com/{{ author.twitter }}">@{{author.twitter }}</a>){% endif %}
                </h1>
                <hr class="nfb-divider" />
                {{ author.formatted_bio|safe }}
            </div>
        </div>
        {% if posts %}
        <h3 class="section-header">blog posts</h3>
        <div class="ui three column stackable grid">
            {% for post in posts %}
            <div class="column">
            {% include 'blog_post_thumb.html' with post=post author=author only %}
            </div>
            {% endfor %}
        </div>
        <hr />
        {% endif %}
        <h3 class="section-header">articles</h3>
        <div class="ui three column stackable grid">
            {% for article in author.get_articles %}
            <div class="column">
            {% include 'article_thumb.html' with article=article only %}
            </div>
            {% endfor %}
        </div>
    </div>
</div>
{% endblock %}
