From 59b595170f948b3fc951dae8d0c5c00071023fb1 Mon Sep 17 00:00:00 2001
From: Claude
No hay nada en {{ label }}.
+{% endif %} +| {{ day }} | {% endfor %}{% else %} |
- {{ 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 }}
|
- {% if meta.dated %}{{ item.date }} | {% 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 %}{{ item.date }} | {% 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 %}{{ item.event_date }} | {% endif %} + {% if meta.dated %}{{ item.event_date }} | {% endif %} {# The flex row goes INSIDE the cell, never on it. `.actions` is display:flex, and atold 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(' |
|---|