-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcalendar.twig
55 lines (48 loc) · 2.31 KB
/
calendar.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
{% extends "_layout.twig" %}
{% import "_local_time.twig" as localTime %}
{% block subtitle %}Calendar{% endblock %}
{% block content %}
{% set month = "" %}
<section id="calendar">
<h1 class="section-heading">Calendar</h1>
{% if records is empty %}
<p class="no-content">There are no events.</p>
{% endif %}
{% set cal_pager = pager('', 1, '_pager_calendar.twig') %}
{{ cal_pager }}
{% for event in records %}
{% set month_change = false %}
{% set month_string = event.event_time|date("F Y") %}
{% if month != month_string %}
{% if loop.first != true %}<hr class="bold">{% endif %}
<div class=cal-month>{{ month_string }}</div>
{% set month_change = true %}
{% set month = month_string %}
{% else %}<hr>{% endif %}
<article class="cal-event">
<div class="cal-event-date" >{{ event.event_time | date('jS') }}</div>
<div class="cal-event-content">
<h2><a href="{{ event.link }}">{{ event.title }}</a></h2>
{% if event.event_time is not empty %}
<p class="detail"><span class="detail-label">When? </span>
{{ localTime.render(event.event_time, event.event_end_day, event.event_time_zone, event.time_display_mode) }}
</p>
{% endif %}
{% if event.location is not empty and event.location.formatted_address is not empty %}
{% if event.location_informal is empty %}
<p class="detail"><span class="detail-label">Where? </span>{{ event.location.formatted_address }}</p>
{% else %}
<p class="detail"><span class="detail-label">Where? </span>{{ event.location_informal }}<br>({{ event.location.formatted_address }})</p>
{% endif %}
{% endif %}
{% if event.web_location is not empty %}
<p class="detail"><span class="detail-label">Link? </span><a href="{{ event.web_location }}">{{ event.web_location_title is empty ? event.web_location : event.web_location_title }}</a></p>
{% endif %}
<p>{{ event.body|preg_replace("/<\s*figure.*?\\/\s*figure\s*>|<\s*p[^>]*>\s*<\s*a\s*.*?\\/\s*a\s*>\s*<\s*\\/\s*p\s*>/si",'')|striptags|excerpt(300) }}</p>
<p><a href="{{ event.link }}">(more info)</a></p>
</div>
</article>
{% endfor %}
{{ cal_pager }}
</section>
{% endblock %}