**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
51 lines
2.0 KiB
HTML
51 lines
2.0 KiB
HTML
{% extends "base.html" %}
|
|
{% block title %}{{ 'Editar evento' if event else 'Nuevo evento' }}{% endblock %}
|
|
|
|
{% set f = fields or event %}
|
|
|
|
{% block main %}
|
|
<div class="feed-head">
|
|
<h1>{{ 'Editar evento' if event else 'Nuevo evento' }}</h1>
|
|
</div>
|
|
|
|
<p class="muted">
|
|
Esto va al calendario de la comunidad, que sólo ven los miembros. No sale al
|
|
sitio público ni se comparte fuera.
|
|
</p>
|
|
|
|
<form class="card" method="post" enctype="multipart/form-data"
|
|
action="{{ url_for('events.edit', event_id=event.id) if event else url_for('events.new') }}">
|
|
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}">
|
|
|
|
<label for="title">Título</label>
|
|
<input id="title" name="title" maxlength="140" required
|
|
value="{{ f.title if f else '' }}">
|
|
|
|
<label for="starts_on">Fecha</label>
|
|
<input id="starts_on" name="starts_on" type="date" required
|
|
value="{{ (f.starts_on if f else '') or suggested }}">
|
|
|
|
<label for="starts_at">Hora <span class="muted small">(opcional)</span></label>
|
|
<input id="starts_at" name="starts_at" type="time" value="{{ (f.starts_at if f else '') or '' }}">
|
|
<p class="muted small">Déjala vacía si dura todo el día.</p>
|
|
|
|
<label for="location">Lugar <span class="muted small">(opcional)</span></label>
|
|
<input id="location" name="location" maxlength="200" value="{{ (f.location if f else '') or '' }}">
|
|
|
|
<label for="body">Detalles <span class="muted small">(opcional)</span></label>
|
|
<textarea id="body" name="body" rows="8" data-markdown
|
|
placeholder="Qué llevar, cómo llegar, a quién avisar.">{{ (f.body_md if event and not fields else (f.body if f else '')) or '' }}</textarea>
|
|
|
|
<label for="picture">Imagen <span class="muted small">(opcional)</span></label>
|
|
<input id="picture" name="picture" type="file" accept="image/*">
|
|
{% if event and event.photo_name %}
|
|
<p class="muted small">Ya tiene una. Subir otra la reemplaza.</p>
|
|
{% endif %}
|
|
|
|
<div class="actions">
|
|
<button class="btn" type="submit">Guardar</button>
|
|
<a class="linkish" href="{{ url_for('events.month') }}">Cancelar</a>
|
|
</div>
|
|
</form>
|
|
{% endblock %}
|