{% extends "happenings/base.html" %}
{% load cache event_tags  %}

{% block extra_title %}Happenings {% if cal_date %} for {{ cal_date }}{% endif %}{% endblock %}

{% block bodyclass %}wide{% endblock %}

{% block content %}
  <h1>{{ site.name }} {{ cal_date }} {{ region }} Events</h1>
  <a href="{% url 'add_event' %}" class="button icon-add right">Add an event</a>
  {% if cal_date or region %}
    <a href="{% url 'events_index' %}" class="button right">All events</a>
  {% endif %}
  {% if object_list %}
    <div class="tabs">
      <ul>
        <li><a href="#list">Events List</a></li>
        <li><a href="#big-calendar">Calendar</a></li>
      </ul>
      <div id="list" class="columned phi">
        <div class="vcalendar">
          {% for object in object_list %}
            {% ifchanged object.start_date.month %}
              <h2 class="kicker">
                {% with object.start_date as d %}
                  <a href="{% url 'events_for_month' m=d|date:"m" y=d|date:"Y" %}">
                    {{ d|date:"F Y" }}
                  </a>
                {% endwith %}
              </h2>
            {% endifchanged %}
            {% include "happenings/includes/event_info.html" %}
          {% endfor %}
        </div> <!-- /vcalendar -->
        <div>
          <p>{% include 'happenings/includes/event_selects.html' %}</p>
          <p>{% load_past_events %}</p>
          <section class="hcal_tables" id="small-calendar"></section>
        </div>
      </div><!-- /list -->
      <div class="hcal_tables" id="big-calendar"></div>
    </div><!-- /tabs -->
  {% else %}
    <h2>We were unable to find any upcoming {{ cal_date }} {{ region }} events.</h2>
  {% endif %}
{% endblock %}
