From 59b595170f948b3fc951dae8d0c5c00071023fb1 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 6 Oct 2026 18:41:56 +0000 Subject: [PATCH] A calendar a phone can read, and tap targets a thumb can hit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Claude-Session: https://claude.ai/code/session_01NizVpJ2dwzCbjCrTLCjeHn --- apps/board/static/board.css | 138 ++++++++++++++++- apps/board/templates/calendar.html | 31 +++- apps/board/templates/content_list.html | 6 +- apps/board/tests/test_events.py | 47 ++++++ apps/board/tests/test_templates.py | 140 +++++++++++++++++- docs/server-setup.md | 30 ++++ themes/vienalatina/assets/css/main.css | 64 +++++++- themes/vienalatina/layouts/page/agenda.html | 18 ++- .../layouts/partials/weekday-name.html | 15 ++ 9 files changed, 460 insertions(+), 29 deletions(-) create mode 100644 themes/vienalatina/layouts/partials/weekday-name.html diff --git a/apps/board/static/board.css b/apps/board/static/board.css index 9379863..420ccc2 100644 --- a/apps/board/static/board.css +++ b/apps/board/static/board.css @@ -309,9 +309,35 @@ textarea { resize: vertical; line-height: 1.55; } word-break: break-all; } +/* A table on a phone becomes one card per row. + * + * It used to be `display: block; overflow-x: auto`, which is a sideways scroll + * inside the page: on Contenido, four columns at 390px put «Editar» and + * «Eliminar» off the right edge with nothing on screen saying they were there, + * and the timestamp column of the Registro broke across three lines. Stacking + * keeps every cell reachable and costs the markup nothing — the same table + * serves both widths. + * + * The columns that do not describe themselves (a bare date, a bare event date) + * carry a `data-label` in the template, drawn here by `attr()`. The ones that + * do — a title, a name, a sentence — are left alone, because a label on every + * line is a form, not a list. */ @media (max-width: 640px) { .feed-head { flex-direction: column; align-items: flex-start; } - .table { display: block; overflow-x: auto; } + + .table, .table tbody, .table tr, .table td { display: block; width: auto; } + .table thead { display: none; } + .table tr { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-light); } + .table tr:last-child { border-bottom: 0; } + .table td { padding: 0.15rem 0; border: 0; } + /* An empty cell would otherwise be a blank line in the middle of the card — + an article with no event date, a row with no actions. */ + .table td:empty { display: none; } + .table td[data-label]::before { + content: attr(data-label) " "; + color: var(--muted); + font-size: 0.8rem; + } } /* --- editor ----------------------------------------------------------- */ @@ -709,6 +735,12 @@ input[type="file"] { .cal__pad { background: transparent; border-color: transparent; } .cal__day--today { border-color: var(--brand); background: var(--brand-softer); } .cal__number { color: var(--subtle); font-weight: 700; } +/* The column header carries the weekday at this width, so saying it again in + every one of thirty-one cells would be noise. The phone block below, where + there is no header row, is the only place it shows. */ +.cal__weekday { display: none; } +.cal__events { display: block; } +.cal__empty { margin: -0.5rem 0 1rem; text-align: center; } .cal__event { display: block; @@ -735,15 +767,44 @@ input[type="file"] { .event-facts p { margin: 0 0 0.25rem; } -/* Seven columns of nothing is what a month grid is on a phone. */ +/* Seven columns of nothing is what a month grid is on a phone, so the month + * becomes a column of days — every day, in order, with its weekday beside it. + * + * Every rule here that decides `display` names the cell's own class, and that + * is the point rather than a style preference. The version that shipped opened + * with `.cal td { display: block }` — specificity (0,1,1) — which outranked + * `.cal__pad { display: none }` at (0,1,0), so the padding cells stayed on + * screen as 92px empty boxes; while `.cal__day:not(:has(.cal__event))` at + * (0,2,0) won, so every real day disappeared. A month with no events drew four + * blank boxes and nothing else, which is exactly what a phone showed. The two + * rules were adjacent and had opposite outcomes, which is why reading them + * looked right. */ @media (max-width: 640px) { - .cal, .cal tbody, .cal tr, .cal td { display: block; width: auto; } + .cal, .cal tbody, .cal tr { display: block; width: auto; } .cal thead { display: none; } - .cal__pad { display: none; } - .cal__day { height: auto; margin-bottom: 0.4rem; } - .cal__day:not(:has(.cal__event)) { display: none; } - .cal__number { display: inline-block; margin-right: 0.5rem; } - .cal__add { display: inline; } + .cal td.cal__pad { display: none; } + .cal td.cal__day { + display: flex; + align-items: baseline; + gap: 0.6rem; + height: auto; + min-height: 44px; + margin-bottom: 0.3rem; + } + /* A week still reads as a week. */ + .cal tr + tr { margin-top: 0.5rem; } + /* Fixed, so the dates line up down the page rather than stepping in and + out as the weekday names change length. */ + .cal__date { flex: 0 0 4.2rem; } + /* `display` and not only the colour: the base rule hides this, because up + there the column header says the weekday. Leaving it out left every row + reading as a bare number — the same shape of mistake as the pads, caught + the same way, by looking at the rendered page. */ + .cal__weekday { display: inline; color: var(--subtle); } + .cal__events { flex: 1; min-width: 0; } + /* No hover on a phone, so the + is simply there; `float` would take it out + of the flex row it is now part of. */ + .cal__add { display: inline-flex; float: none; } } /* --- Gestión → Marca ---------------------------------------------------- */ @@ -879,3 +940,64 @@ input[type="file"] { .tag--ok { background: #e4f2e4; color: #1b5e20; } .tag--warn { background: var(--brand-soft); color: var(--brand-dark); } .tag--bad { background: #f6dcdc; color: var(--danger); } + +/* --- a thumb is not a mouse --------------------------------------------- */ +/* + * A coarse pointer is a touchscreen, not a narrow window — so this is keyed on + * the pointer rather than on width, and a phone held in landscape gets it too. + * + * Everything in here is padding. No type size, colour or spacing changes, so + * the desktop is untouched and the pages look identical; only the hit boxes + * grow. The numbers come from measuring the rendered pages at 390px: the + * navigation links were 37x17, the calendar's + was 7x15, and «Editar», + * «Eliminar» and «Vista previa» were 16px tall. + * + * `.linkish` is deliberately not raised everywhere: it is used mid-sentence in + * several places, where a 44px line box overlaps the lines above and below it. + * It is raised where it is a control rather than a word — which covers every + * one of the measured cases. + */ +@media (pointer: coarse) { + .page-nav { gap: 0.1rem 1.5rem; } + /* Every number here was measured rather than guessed: the padding is + whatever that control's own line box needs to reach 44px, which is the + part of a fingertip a phone can actually locate. 0.7rem on the + navigation came out at 40, so it is 0.85rem. */ + .page-nav a { display: inline-block; padding: 0.85rem 0; } + + .account__menu a, .account__menu button { padding: 0.8rem 0.5rem; } + + .actions .linkish, + .feed-head .linkish, + .cal-bar .linkish, + .cal-bar__today a, + .pager a { + display: inline-block; + padding: 0.9rem 0; + } + .tab { padding: 0.9rem 1.1rem; } + + .md-bar__button { min-height: 44px; min-width: 44px; } + .reaction__button { padding: 0.65rem 0.9rem; } + + /* The buttons and the two links that live in the chrome: the brand at the + top left, which is how you get back to the public site, and the footer's + own link to it. Both were a line of text with no padding at all. */ + .btn { padding-top: 0.85rem; padding-bottom: 0.85rem; } + .site-bar__brand { display: inline-block; padding: 0.7rem 0; } + .site-foot a { display: inline-block; padding: 0.9rem 0; } + + /* Every fold in the members area — Gestionar on a member, Bloquear, the + typeface warning, Avanzado on Marca. A is the control, and at + 15px it is a control you miss and then press something else. */ + summary { padding: 0.95rem 0; } + .account__name { padding: 0.9rem 0; } + + .cal__add { + display: inline-flex; + align-items: center; + justify-content: center; + min-width: 44px; + min-height: 44px; + } +} diff --git a/apps/board/templates/calendar.html b/apps/board/templates/calendar.html index 8e89cd0..c072cb3 100644 --- a/apps/board/templates/calendar.html +++ b/apps/board/templates/calendar.html @@ -25,6 +25,13 @@ Ir a este mes

+{# 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 %} +

No hay nada en {{ label }}.

+{% endif %} + {% for day in weekdays %}{% endfor %} @@ -39,14 +46,26 @@ {% else %} - {% if meta.dated %}{% endif %} + {# data-label is drawn by board.css under 640px, where the header row + is hidden and a bare date in a stacked card says nothing. #} + {% if meta.dated %}{% endif %} {# The column that used to hold the categories. An event date is the one thing left that changes what a post is, and it is what a moderator scanning this list is looking for. #} - {% if meta.dated %}{% endif %} + {% if meta.dated %}{% endif %} {# The flex row goes INSIDE the cell, never on it. `.actions` is display:flex, and a
{{ day }}
- {{ day }} + {# 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. #} + + {{ weekdays[loop.index0] }} + {{ day }} + + {% for item in by_day.get(day, []) %} - - {% if item.starts_at %} {% endif %}{{ item.title }} - {% if item.public %}público{% endif %} - + + {% if item.starts_at %} {% endif %}{{ item.title }} + {% if item.public %}público{% endif %} + {% endfor %} + {% if may_edit %} {# The day is carried into the form, so adding something to the 24th starts with the 24th already filled in. #} diff --git a/apps/board/templates/content_list.html b/apps/board/templates/content_list.html index 644c33b..2382a38 100644 --- a/apps/board/templates/content_list.html +++ b/apps/board/templates/content_list.html @@ -30,11 +30,13 @@ {{ item.title }}
{{ item.name }}
{{ item.date }}{{ item.date }}{{ item.event_date }}{{ item.event_date }} told to be a flex container stops being a table cell: it leaves the row's layout and draws its bottom border diff --git a/apps/board/tests/test_events.py b/apps/board/tests/test_events.py index b253b69..355b4e0 100644 --- a/apps/board/tests/test_events.py +++ b/apps/board/tests/test_events.py @@ -9,6 +9,7 @@ easy to get subtly wrong and hard to notice. from __future__ import annotations +import re from datetime import date import pytest @@ -117,6 +118,52 @@ def test_february_in_a_leap_year_has_twenty_nine_days(client, superadmin_id, sig assert ">30<" not in page +def test_a_month_with_nothing_in_it_says_so_and_still_draws_its_days( + client, superadmin_id, sign_in, quiet_gitea): + """On a phone the month is a column of days rather than a grid, so an empty + month is thirty-one empty rows — which is how you see that it is empty. The + line above them says it in words, as the public agenda does. + + The HTML has always been right here; what shipped was a stylesheet that hid + every day and kept the cells belonging to the neighbouring months, so the + page was six hundred pixels of nothing. The rule that catches that one is in + test_templates.py, where it can be seen. + """ + sign_in(superadmin_id) + page = client.get("/comunidad/calendario?mes=2026-12").get_data(as_text=True) + + assert "No hay nada en diciembre 2026." in page + assert page.count('class="cal__day') == 31 + + +def test_a_month_with_something_in_it_does_not_claim_to_be_empty( + client, an_event, superadmin_id, sign_in): + an_event("Asamblea", "2026-10-24") + sign_in(superadmin_id) + + page = client.get("/comunidad/calendario?mes=2026-10").get_data(as_text=True) + + assert "No hay nada" not in page + assert "Asamblea" in page + + +def test_every_day_carries_its_weekday_for_the_phone( + client, superadmin_id, sign_in, quiet_gitea): + """The column header is hidden at phone width, so without this a day is a + bare number in a list. It comes from the loop position rather than from a + date calculation, which is why this checks the pairing and not the markup: + an off-by-one would put Sunday's name on Monday's row.""" + sign_in(superadmin_id) + page = client.get("/comunidad/calendario?mes=2026-10").get_data(as_text=True) + + assert page.count('class="cal__weekday"') == 31 + # 1 October 2026 is a Thursday, and the grid starts on Monday. + assert re.search(r'cal__weekday">jue\s*1', + page) + assert re.search(r'cal__weekday">dom\s*4', + page) + + # --- what the git server does to this ------------------------------------ def test_the_private_events_survive_a_git_server_that_is_down( diff --git a/apps/board/tests/test_templates.py b/apps/board/tests/test_templates.py index e7536e9..7134455 100644 --- a/apps/board/tests/test_templates.py +++ b/apps/board/tests/test_templates.py @@ -211,8 +211,8 @@ def test_the_form_rule_is_an_exclusion_and_not_a_list_of_accepted_types(): # --- the theme's own chrome ----------------------------------------------- # -# These two read the Hugo theme rather than the members area, which no other -# test here does. They are here because the bug they guard against is this +# These read the Hugo theme rather than the members area, which no other test +# here does. They are here because the bug they guard against is this # suite's recurring shape — CSS that expects markup nobody wrote — and because # pytest is the only thing in this repository that runs on every commit. @@ -252,3 +252,139 @@ def test_the_way_into_the_members_area_is_in_the_bar_itself(): header = (THEME / "layouts" / "partials" / "header.html").read_text(encoding="utf-8") bar = header.split('