{% extends "joyous/calendar_base.html" %}
{% load static wagtailcore_tags %}

{% block cal_events %}
<div class="joy-cal-list {% block cal_view_class %}{% endblock %}" data-version="{{ version }}">
  {% for title, event, url in events %}
    {% block event_item %}{% include "joyous/includes/event_item.html" %}{% endblock event_item %}
  {% endfor %}
</div>

{% block events_pagination %}
{% if events.has_other_pages %}
<ul class="joy-pg">
  {% if events.has_previous %}
  <li class="joy-pg__page"><a class="joy-pg__ctrl" href="?page={{ events.previous_page_number }}">&laquo;</a></li>
  {% else %}
  <li  class="joy-pg__page"><span class="joy-pg__ctrl joy-pg__ctrl--disabled">&laquo;</span></li>
  {% endif %}{% for i in events.paginator.page_range %}{% if events.number == i %}
  <li  class="joy-pg__page"><span class="joy-pg__num joy-pg__num--active">{{ i }}</span></li>
  {% else %}
  <li class="joy-pg__page"><a class="joy-pg__num" href="?page={{ i }}">{{ i }}</a></li>
  {% endif %} {% endfor %} {% if events.has_next %}
  <li class="joy-pg__page"><a class="joy-pg__ctrl" href="?page={{ events.next_page_number }}">&raquo;</a></li>
  {% else %}
  <li  class="joy-pg__page"><span class="joy-pg__ctrl joy-pg__ctrl--disabled">&raquo;</span></li>
  {% endif %}
</ul>
{% endif %}
{% endblock events_pagination %}
{% endblock cal_events %}
