vienalatina/apps/board/templates/calendar.html
Claude 59b595170f
A calendar a phone can read, and tap targets a thumb can hit
The private calendar rendered as six hundred pixels of nothing on a phone.
The cause was two adjacent rules in board.css with opposite outcomes:

    .cal, .cal tbody, .cal tr, .cal td { display: block }   /* (0,1,1) */
    .cal__pad { display: none }                             /* (0,1,0) */
    .cal__day:not(:has(.cal__event)) { display: none }      /* (0,2,0) */

`.cal td` outranks `.cal__pad`, so every cell belonging to a neighbouring
month stayed on screen as a 92px empty box; `.cal__day:not(:has(…))`
outranks `.cal td`, so every real day disappeared. A month with no events
drew four blank boxes and nothing else, with correct HTML throughout —
which is why reading the file looked right and no test could see it.

Both calendars are now a column of every day of the month below 640px,
with the weekday beside the number (the column header is hidden there),
the days carrying something standing out, and a line saying so when the
month is empty. The public agenda gets the same shape deliberately: the
private calendar lists the public events, and a member moves between the
two. Every rule that decides `display` now names its cell's own class.

Measured rather than reasoned about, in headless Chromium at 320 and 390
across all 22 members-area screens and the public site in three languages:

  - padding cells 0px tall, 31 of 31 days drawn, no horizontal overflow
  - the ☰ ran off the right edge of a 320px Portuguese home page, because
    «Comunidade» is three letters longer than «Comunidad»; the bar now
    gives way at 360px
  - the navigation links were 37x17, the calendar's + was 7x15, the footer
    links 16px tall. A `pointer: coarse` block in each stylesheet raises
    them to 44, padding only, so the desktop is untouched. Links inside a
    sentence are left alone, as WCAG exempts them.

Registro de actividad and Contenido stop being a sideways-scrolling table
on a phone and stack one card per row, the two columns that do not
describe themselves labelled from `data-label`.

Guards: three stylesheet tests that compute specificity and run the
cascade for a padding cell, a day cell and the weekday label, in both
stylesheets — each verified by putting the shipped rules back. Plus three
request-level tests: an empty month says so and still draws its 31 days,
a month with events does not claim to be empty, and every day carries the
right weekday.

Members area only to deploy — no migration, no schema change — except the
agenda and the stylesheet, which reach the site through the pipeline.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn
2026-10-06 18:41:56 +00:00

88 lines
3.1 KiB
HTML

{% extends "base.html" %}
{% block title %}Calendario{% endblock %}
{% block main %}
<div class="feed-head">
<h1>Calendario</h1>
{% if may_edit %}
<a class="btn" href="{{ url_for('events.new') }}">Añadir evento</a>
{% endif %}
</div>
{% if public_missing %}
<p class="flash flash--error">
No se pudo leer la agenda pública del servidor de git, así que aquí abajo
faltan los eventos del sitio. Los internos están todos.
</p>
{% endif %}
<nav class="cal-bar" aria-label="Mes">
<a class="linkish" href="{{ url_for('events.month', mes=previous) }}">← Anterior</a>
<strong>{{ label }}</strong>
<a class="linkish" href="{{ url_for('events.month', mes=next) }}">Siguiente →</a>
</nav>
<p class="muted small cal-bar__today">
<a href="{{ url_for('events.month', mes=this_month) }}">Ir a este mes</a>
</p>
{# Said above the grid rather than below it: on a phone the month is a column
of days, and a line under thirty-one empty rows is a line nobody reads. The
public agenda says the same thing in its own words (agenda.html). #}
{% if not by_day %}
<p class="muted cal__empty">No hay nada en {{ label }}.</p>
{% endif %}
<table class="cal">
<thead>
<tr>{% for day in weekdays %}<th scope="col">{{ day }}</th>{% endfor %}</tr>
</thead>
<tbody>
{% for week in weeks %}
<tr>
{% for day in week %}
{# calendar.monthdayscalendar pads the first and last weeks with
zeroes, which are days belonging to the neighbouring months. #}
{% if day == 0 %}
<td class="cal__pad"></td>
{% else %}
<td class="cal__day {{ 'cal__day--today' if day == today }}">
{# The weekday travels with the number because on a phone the
header row is hidden — the grid is a column there, and a day
without its weekday is just an integer. `loop.index0` of this
loop *is* the weekday, since each week is seven cells
starting on Monday, so nothing has to be computed in Python.
Above 640px .cal__weekday is display:none and the column
header says it instead. #}
<span class="cal__date">
<span class="cal__weekday">{{ weekdays[loop.index0] }}</span>
<span class="cal__number">{{ day }}</span>
</span>
<span class="cal__events">
{% for item in by_day.get(day, []) %}
<a class="cal__event {{ 'cal__event--public' if item.public }}"
href="{{ item.url }}">
{% if item.starts_at %}<time>{{ item.starts_at }}</time> {% endif %}{{ item.title }}
{% if item.public %}<span class="tag tag--quiet">público</span>{% endif %}
</a>
{% endfor %}
</span>
{% if may_edit %}
{# The day is carried into the form, so adding something to the
24th starts with the 24th already filled in. #}
<a class="cal__add" title="Añadir evento este día"
href="{{ url_for('events.new', dia='%s-%02d'|format(month_key, day)) }}">+</a>
{% endif %}
</td>
{% endif %}
{% endfor %}
</tr>
{% endfor %}
</tbody>
</table>
<p class="muted small">
Los eventos marcados <span class="tag tag--quiet">público</span> están en
vienalatina.com y los ve cualquiera. Los demás sólo se ven desde aquí.
</p>
{% endblock %}