65 lines
1.9 KiB
HTML
65 lines
1.9 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}Weekends - Edward Betts{% endblock %}
|
|
|
|
{% block content %}
|
|
<div class="p-2">
|
|
|
|
<h1>Weekends</h1>
|
|
<table class="table table-hover w-auto">
|
|
<thead>
|
|
<tr>
|
|
<th class="text-end">Week</th>
|
|
<th class="text-end">Date</th>
|
|
<th>Saturday</th>
|
|
<th>Saturday Location</th>
|
|
<th>Sunday</th>
|
|
<th>Sunday Location</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
|
|
{% set current_isocalendar = today.isocalendar() %}
|
|
|
|
{% for weekend in items %}
|
|
{% set week_number = weekend.date.isocalendar().week %}
|
|
{% set iso_week_year = weekend.date.isocalendar().year %}
|
|
{% if week_number == current_week_number and iso_week_year == current_isocalendar.year %}
|
|
{% set extra_class = " bg-warning-subtle" %}
|
|
{% else %}
|
|
{% set extra_class = "" %}
|
|
{% endif %}
|
|
<tr{% if week_number == current_week_number %} class="bg-warning-subtle"{% endif %}>
|
|
<td class="text-end{{ extra_class }}">
|
|
{{ week_number }}
|
|
</td>
|
|
<td class="text-end text-nowrap{{ extra_class }}">
|
|
{{ weekend.date.strftime("%-d %b %Y") }}
|
|
</td>
|
|
{% for day in "saturday", "sunday" %}
|
|
{% if extra_class %}<td class="{{ extra_class|trim }}">{% else %}<td>{% endif %}
|
|
{% if weekend[day] %}
|
|
{% for event in weekend[day] %}
|
|
<a href="{{ event.url }}">{{ event.title }}</a>{% if not loop.last %},{%endif %}
|
|
{% endfor %}
|
|
{% else %}
|
|
<strong>free</strong>
|
|
{% endif %}
|
|
</td>
|
|
{% if extra_class %}<td class="{{ extra_class|trim }}">{% else %}<td>{% endif %}
|
|
{% set city, country = weekend[day + '_location'] %}
|
|
{% if city == "Bristol" and country.alpha_2 | upper == "GB" %}
|
|
{# <strong>home</strong> #}
|
|
{% else %}
|
|
{{ city }}, {{ country.flag }} {{ country.name }}
|
|
{% endif %}
|
|
</td>
|
|
{% endfor %}
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{% endblock %}
|
|
|