{% extends "coderedcms/pages/web_page.html" %}
{% load coderedcms_tags static wagtailcore_tags wagtailimages_tags %}
{% block content_post_body %}
{% if self.default_calendar_view %}
<div class="container">
  <div class="row">
    <div class="col pt-5 pb-5">
      {% include "coderedcms/includes/ical/calendar.html" %}
    </div>
  </div>
  <div class="row">
    <div class="col pb-5">
      {% include "coderedcms/includes/ical/calendar_ical_button.html" %}
    </div>
  </div>
</div>
{% endif %}
{% endblock %}
{% block index_content %}
<div class="container">
  {% for event in index_paginated %}
  <div class="row">
    {% block event_cover_image %}
    {% if event.cover_image %}
    <div class="col-md">
      {% image event.cover_image fill-1600x900 format-webp as cover_image %}
      <a href="{{ event.url }}" title="{{ event.title }}"><img src="{{ cover_image.url }}" class="w-100" alt="{{ event.title }}"></a>
    </div>
    {% endif %}
    {% endblock %}
    {% block event_body_preview %}
    <div class="col-md">
      <h3><a href="{{ event.url }}">{{ event.title }}</a></h3>
      <p>{{ event.most_recent_occurrence.0 }}</p>
      <p>{{ event.body_preview }}</p>
    </div>
    {% endblock %}
  </div>
  {% if not forloop.last %}
  <hr>
  {% endif %}
  {% endfor %}
  {% include "coderedcms/includes/pagination.html" with items=index_paginated %}
</div>
{% endblock %}

{% block coderedcms_assets %}
{{ block.super }}
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.2/main.min.css" integrity="sha256-5veQuRbWaECuYxwap/IOE/DAwNxgm4ikX7nrgsqYp88=" crossorigin="anonymous">
{% endblock %}

{% block coderedcms_scripts %}
{{ block.super }}
<script src="https://cdn.jsdelivr.net/npm/fullcalendar@5.11.2/main.min.js" integrity="sha256-sR+oJaZ3c0FHR6+kKaX1zeXReUGbzuNI8QTKpGHE0sg=" crossorigin="anonymous"></script>
<script src="{% static 'coderedcms/js/crx-events.js' %}?v={% coderedcms_version %}"></script>
{% endblock %}
