{% extends 'base.html' %}

{% block twittercard %}summary{% endblock %}

{% block title %}Archives{% endblock %}
{% block description %}All {{ articles.count }} articles published on Notes From Below{% endblock %}
{% block longdescription %}All {{ articles.count }} articles published on Notes From Below{% endblock %}

{% block content %}
<div class="page-content">
    <div class="ui container">
	<br><br>
        <h1 class="ui header" style="font-size:1.5em">Arhiv</h1>
        <div class="ui middle aligned stackable grid">
            <div class="six wide left aligned column" style="padding-left:15px">
                {% if total_articles %}
                {% include "pagination.html" with items=articles category=category only %}
                {% endif %}
            </div>
            <div class="five wide column">
                {% include "search.html" %}
            </div>
        </div>
        {% if query %}
        <div class="ui message">
            <div class="header">
                Našel {{ total_articles }} članek/i {{ total_articles }} za '{{ query }}'
            </div>
            {% if not total_articles %}
            You can currently only find articles based on title and subtitle.
            If you want to search based on a phrase in the body of the article,
            try Google.
            {% endif %}
            {% if tags or authors %}
            <ul class="list">
                {% if tags %}
                <li>
                    Found tag{{ tags.count|pluralize }}:
                    {% for tag in tags %}<a href="{{ tag.get_absolute_url }}">{{ tag }}</a>
                    {% with count=tag.articles.count %}
                    ({{ count }} article{{ count|pluralize }})
                    {% if not forloop.last %}/{% endif %}
                    {% endwith %}
                    {% endfor %}
                </li>
                {% endif %}
                {% if authors %}
                <li>
                    Found author{{ authors.count|pluralize }}:
                    {% for author in authors %}<a href="{{ author.get_absolute_url }}">{{ author }}</a>
                    {% with count=author.get_articles.count %}
                    ({{ count }} article{{ count|pluralize }})
                    {% if not forloop.last %}/{% endif %}
                    {% endwith %}
                    {% endfor %}
                </li>
                {% endif %}
            </ul>
            {% endif %}
        </div>
        {% endif %}
        <div class="ui three column stackable grid" style="padding-left:15px">
            {% for article in articles %}
            <div class="column">
            {% include 'article_thumb.html' with article=article only %}
            </div>
            {% endfor %}
        </div>
        {% if total_articles %}
        <div class="ui middle aligned stackable grid">
            <div class="sixteen wide left aligned column" style="padding-left:15px">
                {% include "pagination.html" with items=articles category=category only %}
            </div>
        </div>
        {% endif %}
    </div>
</div>
{% endblock %}
