summaryrefslogtreecommitdiff
path: root/templates/events.html
blob: 7a75111d60cb7a70f8a04a0cc714d6651e881f6c (plain)
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
56
57
{% extends "base.html" %}
{% import "macros.html" as macros %}

{% block content %}
<h1>
  {{ section.title }}
</h1>

{{ section.content | safe }}

{% set groups = ['upcoming', 'recent', 'past'] %}
{% set meetups = load_data(path="events.toml") %}

{% for group in groups %}

    {% if meetups[group] %}
    <section>
        <h2 id="{{group}}">{{ group | capitalize }}</h2>

        {% set events_sorted = meetups[group] | sort(attribute="date") | reverse %}
        
        {# Reverse sorting again for upcoming events #}
        {% if group == 'upcoming' %}{% set events_sorted = events_sorted | reverse  %}{% endif %}

        {% for event in events_sorted %}
        {% set event_page = section.pages | filter(attribute="title", value=event.title) | first%}
        
        {% if event_page %}
            <a class="event-page-link" href="../events/{{ event_page.slug }}">
                <h3>
                    {{ event_page.title }}
                </h3>
            </a>
        {% else %}
            <article>
                <details {% if group == 'upcoming' %}open{% endif %}>
                    <summary>
                        <h3>
                            {{ event.title }}
                        </h3>
                    </summary>
                    <div>
                        {{ macros::event_attributes(event=event) }}
                    </div>
                </details>
            </article>
            {% endif %}
        {% endfor %}
    </section>
    {% endif %}

{% endfor %}
{% endblock content %}

{% block footer %}
    {{ macros::last_update() }}
{% endblock footer %}