{% extends 'base.html' %}

{% block image %}{{ issue.image.url }}{% endblock %}

{% block title %}{{ issue.title }} (#{{ issue.number }}){% endblock %}
{% block description %}The {{ issue.date|date:"F Y" }} issue of Notes From Below{% endblock %}
{% block date %}{{ issue.date|date:"Y-m-d" }}{% endblock %}

{% block content %}
<div class="page-content">
    <div class="ui container"><br>
        {% if not issue.published %}
        <div class="ui error message">
            <div class="header">
                Not published
            </div>
            <p>This issue hasn't yet been published, so it won't be
            linked anywhere on the website.</p>
            <p>All the articles associated with this issue (whether
            they've been published or not) are listed below.</p>
        </div>
        {% endif %}
        {% if request.user.is_staff %}
        <div class="ui center aligned basic segment">
            <a href="{% url 'admin:journal_issue_change' issue.pk %}"
               class="ui blue icon button">
               <i class="edit icon"></i>
               Edit in admin
            </a>
            <a href="{% url 'admin:journal_article_add' %}?issue={{ issue.pk }}"
               class="ui blue basic icon button">
               <i class="plus icon"></i>
               Add a new article
            </a>
            {% if not issue.published %}
            <a href="{% url 'issue_publish' issue.slug %}"
               class="ui green button">
               <i class="checkmark icon"></i>
               Prepare for publication
            </a>
            {% endif %}
        </div>
        {% endif %}
                <div class="ui stackable two column grid" style="padding-left:15px">
                    <div class="column">
                        <div class="section">
                                <div class="sub header">
                                    {{ issue.date|date:"F, Y"}}
                                </div>
                        </div>
                    </div>
                </div>
        <br />
        <div class="ui three column stackable grid" style="padding-left:15px">
            {% for article in issue.get_articles %}
            <div class="column">
                {% include 'article_thumb.html' with article=article only %}
            </div>
            {% endfor %}
        </div>
    </div>
</div>
{% endblock %}

