{% extends "radpress/base.html" %}

{% load trans from i18n %}
{% load url from future %}

{% block content %}
  <div id="blog-archive" class="set-content-margin">
    <h1>{% trans "Blog Archive" %}</h1>

    {% include "radpress/_archive_list.html" %}
  </div>

  {% if page_obj %}
    <ul class="pager">
      {% if page_obj.has_previous %}
        <li class="previous">
          <a href="?{% if enabled_tag %}tag={{ enabled_tag }}{% endif %}&page={{ page_obj.previous_page_number }}">previous</a>
        </li>
      {% endif %}
      {% if page_obj.has_next %}
        <li class="next">
          <a href="?{% if enabled_tag %}tag={{ enabled_tag }}{% endif %}&page={{ page_obj.next_page_number }}">next</a>
        </li>
      {% endif %}
    </ul>
  {% endif %}
{% endblock %}

{% block sidebar %}
  <div class="sidebar-box">
    {% include "radpress/_search_form.html" %}
  </div>

  <div id="archive-tags">
    <h2>{% trans "Tags" %}</h2>

    {% if enabled_tag %}
      <a href="{% url 'radpress-archive' %}" class="remove-tag">
        {% trans "remove tag" %}
      </a>
    {% endif %}

    <div class="tags">
      {% for tag in tag_list %}
        <a class="label {% if tag.slug != enabled_tag %} label-info{% endif %}"
           href="{% url 'radpress-archive' %}?tag={{ tag.slug }}">
          <i class="icon-tag icon-white"></i>
          {{ tag.name }}
        </a>
      {% empty %}
        <span class="warning">{% trans "No tag found." %}</span>
      {% endfor %}
    </div>
  </div>
{% endblock %}
