Show 8-day Bristol home weather on the index and weekends pages. Show destination weather per day on the trip list and trip page. Cache forecasts in ~/lib/data/weather/ and refresh via update.py. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
71 lines
2.3 KiB
HTML
71 lines
2.3 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>Saturday Weather</th>
|
||
<th>Sunday</th>
|
||
<th>Sunday Location</th>
|
||
<th>Sunday Weather</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 %}
|
||
{{ city }}, {{ country.flag }} {{ country.name }}
|
||
{% endif %}
|
||
</td>
|
||
{% if extra_class %}<td class="{{ extra_class|trim }}">{% else %}<td>{% endif %}
|
||
{% set w = weekend[day + '_weather'] %}
|
||
{% if w %}
|
||
<img src="https://openweathermap.org/img/wn/{{ w.icon }}.png" alt="{{ w.status }}" title="{{ w.detailed_status }}" width="25" height="25">
|
||
{{ w.temp_min }}–{{ w.temp_max }}°C
|
||
{% endif %}
|
||
</td>
|
||
{% endfor %}
|
||
</tr>
|
||
{% endfor %}
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
|
||
{% endblock %}
|
||
|