vienalatina/apps/board/templates/base.html
Claude 5e8ee5ad20
Two calendars: one for everybody, one for the members
**Public events are posts.** A new Evento category brings three fields with it —
event_date, event_time, event_location — and the first is required, because a
post's own `date` is when it was announced and an event announced three weeks
early would otherwise land in the agenda on the wrong day. Members propose
events through the same queue as everything else, and the date survives approval
untouched: the event the member described is the event that gets published.

An event's page leads with the day, the time and the place before the title,
shows its picture full width, and offers "añadir a mi calendario" — a real .ics
beside the page, generated because the editor writes `outputs: ["HTML", "ics"]`
into an event's frontmatter and nothing else asks for that format. It carries
Event structured data as well as the BlogPosting it already had, which is what
puts a date beside the result in a search listing.

/page/agenda/ is a month grid per month, every month from the first event to the
last built at build time, with a script that shows one and moves between them.
That arrangement is the point: with JavaScript off every month is on the page as
a list, with it on nothing is fetched to change months, and the month it opens on
is the reader's rather than the one the site was built in. Hugo exposes no
AddDate, so the length of a month is a table plus the leap rule and the first
weekday falls out of formatting the date — it looks like something simpler was
missed, and it is not.

**The private calendar** is a sixth section: rows in SQLite, written by admins,
read by every member, never published. It shows the public events too, marked,
so a member has one place to look rather than two — they come from the
content_cache the editor's listing already fills, which is why migration 5 adds
three columns to it and to submissions. The grid is Python's own
calendar.Calendar: no date arithmetic of mine anywhere in it.

Two things the tests found on the way:

gitea.py let `requests`' own exceptions through. They inherit from OSError, not
from GiteaError, so the calendar's careful "keep working while the git server is
down" would have been defeated by a refused connection — the page would have
500ed instead. Every transport failure is now a GiteaError, raised at the one
place that touches the wire. This is the third bug of exactly that shape in this
module.

An admin's erasure clears events.created_by rather than reassigning it. The
meeting still happens after they leave; the event belongs to the association.

509 tests pass, and the site builds with Hugo 0.135.0 under the pipeline's own
--panicOnWarning.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-03 09:53:54 +00:00

85 lines
3.4 KiB
HTML

{# Chrome deliberately mirrors the public site's header and footer, so moving
between vienalatina.com and the members area does not feel like leaving. #}
<!DOCTYPE html>
<html lang="es">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex, nofollow">
<title>{% block title %}Comunidad{% endblock %} — Viena Latina</title>
<link rel="stylesheet" href="{{ url_for('static', filename='board.css') }}">
<script src="{{ url_for('static', filename='board.js') }}" defer></script>
</head>
<body>
<header class="site-bar">
<div class="site-bar__inner">
<a class="site-bar__brand" href="/"><span class="site-bar__brand-text">Viena Latina</span></a>
{% if g.member %}
{# <details> rather than a button with a handler: the CSP has no
'unsafe-inline', so a menu that needs onclick="" is a menu that
silently never opens. This one works with the CSS and the HTML
alone. #}
<details class="account">
<summary class="account__name">{{ g.member.display_name }}</summary>
<div class="account__menu">
<a href="{{ url_for('profiles.edit') }}">Mi perfil</a>
<a href="{{ url_for('members.export') }}">Descargar mis datos</a>
<form method="post" action="{{ url_for('auth.logout') }}">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
<button class="linkish" type="submit">Salir</button>
</form>
</div>
</details>
{% endif %}
</div>
{% if g.member %}
<nav class="site-bar__pages" aria-label="Secciones">
{# Five entries, and four of them are the same for everybody. The role
only decides whether Gestión is there — it used to decide three of
them, which is how an ordinary member ended up signing in to a wall
and a member list with their own profile and their own private
messages hidden from them. Account items are in the corner menu
above, because "Mi perfil" is not a section of the site. #}
<ul class="page-nav">
<li><a href="{{ url_for('home.index') }}">Inicio</a></li>
<li><a href="{{ url_for('board.threads') }}">Muro</a></li>
<li>
<a href="{{ url_for('messages.inbox') }}">Privados{% set unread = unread_private() %}{% if unread %} <span class="tag">{{ unread }}</span>{% endif %}</a>
</li>
<li>
{# The badge counts what is waiting for a moderator, so for
anybody else the function returns 0 and nothing is drawn. #}
<a href="{{ url_for('submissions.index') }}">Publicaciones{% set waiting = pending_review() %}{% if waiting %} <span class="tag">{{ waiting }}</span>{% endif %}</a>
</li>
<li><a href="{{ url_for('events.month') }}">Calendario</a></li>
{% if g.member.role in ('owner', 'admin') %}
<li><a href="{{ url_for('home.gestion') }}">Gestión</a></li>
{% endif %}
</ul>
</nav>
{% endif %}
</header>
<div class="page-shell">
<main class="feed">
{% with messages = get_flashed_messages(with_categories=true) %}
{% for category, message in messages %}
<p class="flash flash--{{ category }}">{{ message }}</p>
{% endfor %}
{% endwith %}
{% block main %}{% endblock %}
</main>
<footer class="site-foot">
<a href="/">Ir al sitio público</a>
{% if g.member %} · <a href="{{ url_for('members.index') }}">Miembros</a>{% endif %}
<div class="site-foot__legal">Viena Latina © {{ current_year }} · Área privada</div>
</footer>
</div>
</body>
</html>