diff --git a/apps/board/content.py b/apps/board/content.py
index 79ff3a8..d36609c 100644
--- a/apps/board/content.py
+++ b/apps/board/content.py
@@ -59,13 +59,6 @@ COLLECTIONS = {
},
}
-# The one category that changes what a post *is* rather than what it is about:
-# tick it and the post needs a date of its own, appears in the agenda, renders
-# with the date and the place at the top, and offers an .ics.
-EVENT_CATEGORY = "Evento"
-
-CATEGORIES = ["Evento", "Turismo", "Cultura", "Gastronomía", "Comunidad", "Comercio"]
-
UPLOAD_FOLDER = "static/uploads"
TITLE_MAX = 140
@@ -149,8 +142,6 @@ def frontmatter_for(collection: str, form: dict) -> dict:
# person: it is a build instruction, not something to explain in a form.
fields["outputs"] = ["HTML", "ics"]
if collection == "post":
- if form["categories"]:
- fields["categories"] = form["categories"]
if form["description"]:
fields["description"] = form["description"]
if form["image"]:
@@ -181,17 +172,17 @@ def _cache_read(path: str, sha: str):
def _cache_write(path: str, sha: str, fm: dict) -> None:
get_db().execute(
- """INSERT INTO content_cache (path, sha, title, date, categories, generated,
+ """INSERT INTO content_cache (path, sha, title, date, generated,
event_date, event_time, event_location)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)
ON CONFLICT(path) DO UPDATE SET
sha = excluded.sha, title = excluded.title, date = excluded.date,
- categories = excluded.categories, generated = excluded.generated,
+ generated = excluded.generated,
event_date = excluded.event_date, event_time = excluded.event_time,
event_location = excluded.event_location,
updated_at = datetime('now')""",
(path, sha, str(fm.get("title", "")), str(fm.get("date", "")),
- ", ".join(fm.get("categories") or []), 1 if fm.get("translated_from") else 0,
+ 1 if fm.get("translated_from") else 0,
# Cached for the private calendar, which shows public events beside the
# internal ones and would otherwise read every post's frontmatter on
# every page view to find out when they are.
@@ -223,7 +214,7 @@ def listing(collection: str) -> list[dict]:
items.append({
"name": name, "path": path, "sha": sha,
"title": row["title"] or name,
- "date": row["date"], "categories": row["categories"],
+ "date": row["date"],
"event_date": row["event_date"] or "",
"event_time": row["event_time"] or "",
"event_location": row["event_location"] or "",
@@ -275,8 +266,6 @@ def _read_form(collection: str) -> tuple[dict, str, list[str]]:
except ValueError:
errors.append("La fecha debe tener el formato AAAA-MM-DD.")
- categories = [c for c in request.form.getlist("categories") if c in CATEGORIES]
-
# A page's place in the menu. `parent` is another page's basename — the one
# translate.py uses to pair siblings, so a parent chosen once holds in all
# three languages — and the menu is built from these, not from a list in
@@ -297,7 +286,7 @@ def _read_form(collection: str) -> tuple[dict, str, list[str]]:
# When a post is an event, it has a date of its own. The post's `date` above
# is when it was announced — often weeks earlier, and the thing Hugo sorts
# the blog by — so the two cannot be the same field.
- event = read_event_fields(request.form, categories, errors)
+ event = read_event_fields(request.form, errors)
faq = clean_faq(request.form.get("faq", ""))
image_alt = request.form.get("image_alt", "").strip()[:200]
@@ -322,7 +311,7 @@ def _read_form(collection: str) -> tuple[dict, str, list[str]]:
errors.append("El cuerpo no puede estar vacío.")
fields = {
- "title": title, "date": when, "categories": categories,
+ "title": title, "date": when,
"description": request.form.get("description", "").strip(),
"image": image,
"manual_translation": request.form.get("manual_translation") == "on",
@@ -368,27 +357,33 @@ def commit_picture(data: bytes, filename: str, author=None) -> str:
return f"/uploads/{name}"
-def read_event_fields(form, categories: list[str], errors: list[str]) -> dict:
- """The three fields that come with the Evento category.
+def read_event_fields(form, errors: list[str]) -> dict:
+ """The three fields that make a post an event.
+
+ **The date is the marker.** There used to be an «Evento» category to tick
+ first, and ticking it without filling the date in was an error the form had
+ to refuse. With the categories gone there is nothing to tick: a post that
+ carries a date is an event, which also means there is no way left to say
+ "this is an event" and then not say when.
Shared by the editor and by a member's proposal, so a post written by a
moderator and one approved from the queue carry the same frontmatter. The
- date is required and the other two are not: an event with no time is an
- all-day event, and one with no place is a mistake somebody can fix later
- rather than a reason to refuse the whole post.
+ other two fields stay optional: an event with no time is an all-day event,
+ and one with no place is a mistake somebody can fix later rather than a
+ reason to refuse the whole post.
- Returns empty strings when the category is absent, so an ordinary article
- never carries empty event lines in its frontmatter.
+ Returns empty strings when no date was given, so an ordinary article never
+ carries empty event lines in its frontmatter.
"""
- if EVENT_CATEGORY not in categories:
+ raw = form.get("event_date", "").strip()
+ if not raw:
return {"event_date": "", "event_time": "", "event_location": ""}
- raw = form.get("event_date", "").strip()
try:
event_date = datetime.strptime(raw, "%Y-%m-%d").date().isoformat()
except ValueError:
event_date = ""
- errors.append("Un evento necesita fecha, con el formato AAAA-MM-DD.")
+ errors.append("La fecha del evento debe tener el formato AAAA-MM-DD.")
event_time = form.get("event_time", "").strip()
if event_time and not EVENT_TIME.match(event_time):
@@ -505,7 +500,7 @@ def new(collection: str):
meta = _collection_or_404(collection)
if request.method == "GET":
return render_template("content_form.html", collection=collection, meta=meta,
- categories=CATEGORIES, item=None, fields=None,
+ item=None, fields=None,
body="", today=date_type.today().isoformat(),
parents=possible_parents(collection))
@@ -548,7 +543,6 @@ def edit(collection: str, name: str):
fields = {
"title": fm.get("title", ""),
"date": fm.get("date"),
- "categories": fm.get("categories") or [],
"description": fm.get("description", ""),
"image": fm.get("image", ""),
"manual_translation": bool(fm.get("manual_translation")),
@@ -567,7 +561,7 @@ def edit(collection: str, name: str):
"event_location": fm.get("event_location", ""),
}
return render_template("content_form.html", collection=collection, meta=meta,
- categories=CATEGORIES, item={"name": name, "sha": sha},
+ item={"name": name, "sha": sha},
fields=fields, body=body,
today=date_type.today().isoformat(),
parents=possible_parents(collection, name))
@@ -628,7 +622,7 @@ def preview(collection: str):
sha = request.form.get("sha", "")
item = {"name": request.form.get("name", ""), "sha": sha} if sha else None
return render_template("content_form.html", collection=collection, meta=meta,
- categories=CATEGORIES, item=item, fields=fields, body=body,
+ item=item, fields=fields, body=body,
today=date_type.today().isoformat(),
parents=possible_parents(collection,
item["name"] if item else ""),
@@ -686,7 +680,7 @@ def _back_to_form(collection, meta, fields, body, errors, item):
for message in errors:
flash(message, "error")
return render_template("content_form.html", collection=collection, meta=meta,
- categories=CATEGORIES, item=item, fields=fields, body=body,
+ item=item, fields=fields, body=body,
today=date_type.today().isoformat(),
parents=possible_parents(collection,
item["name"] if item else "")), 400
diff --git a/apps/board/events.py b/apps/board/events.py
index 067bcde..e270a0d 100644
--- a/apps/board/events.py
+++ b/apps/board/events.py
@@ -3,9 +3,9 @@
What the association is doing and when, for the people inside: a meeting, a
rehearsal, a visit somewhere. Admins write them, every member reads them, and
nothing here is ever published — no Open Graph, no sitemap, nothing written to
-/var/www. That is the whole difference between this and a post in the Evento
-category, and it is why the two live in different places rather than behind a
-flag on one.
+/var/www. That is the whole difference between this and a public post carrying
+an event date, and it is why the two live in different places rather than behind
+a flag on one.
**The public events appear here too**, marked as public and linking to the site,
because a member should have one place to look rather than two. They come from
diff --git a/apps/board/migrations.py b/apps/board/migrations.py
index 29447a4..c2c8c03 100644
--- a/apps/board/migrations.py
+++ b/apps/board/migrations.py
@@ -232,6 +232,23 @@ def _rooms_for_a_date_of_its_own(db: sqlite3.Connection) -> None:
db.execute(f"ALTER TABLE {table} ADD COLUMN {column} TEXT")
+def _no_more_categories(db: sqlite3.Connection) -> None:
+ """Take the category column off the two tables that carried one.
+
+ `DROP COLUMN` rather than a rebuild: SQLite has had it since 3.35 and
+ neither column is in a CHECK, an index or a foreign key, which are the three
+ things that make it refuse. The rebuilds in steps 1 and 4 exist because a
+ CHECK cannot be altered any other way — this needs none of that.
+
+ Dropping rather than leaving a column nobody writes to: a dead column is a
+ question for whoever reads this schema next, and the answer ("we used to
+ have categories") is not in the file.
+ """
+ for table in ("content_cache", "submissions"):
+ if "categories" in _columns(db, table):
+ db.execute(f"ALTER TABLE {table} DROP COLUMN categories")
+
+
# (number, description, function). The number is the value written to
# user_version once the step succeeds.
STEPS = [
@@ -240,6 +257,7 @@ STEPS = [
(3, "members can have a public page", _members_get_a_public_page),
(4, "members can be moderators", _members_can_moderate),
(5, "events carry a date of their own", _rooms_for_a_date_of_its_own),
+ (6, "there are no categories any more", _no_more_categories),
]
diff --git a/apps/board/profiles.py b/apps/board/profiles.py
index 90c6189..8af246e 100644
--- a/apps/board/profiles.py
+++ b/apps/board/profiles.py
@@ -42,6 +42,10 @@ LINKS_MAX = 8
# collision harmless rather than dangerous — Hugo wins and the profile is
# simply unreachable — so this exists to stop somebody discovering months later
# that their page has never loaded for anybody.
+#
+# `categories` and `tags` stay on the list although the taxonomies are gone: the
+# site served those paths for a year, and a URL somebody may still have in a
+# bookmark or a search index should not quietly become a member's profile.
RESERVED = {
"de", "pt-br", "es", "en", # language trees
"page", "post", "posts", "categories", "tags", "category", "tag",
diff --git a/apps/board/schema.sql b/apps/board/schema.sql
index ef498e2..9ad1ca4 100644
--- a/apps/board/schema.sql
+++ b/apps/board/schema.sql
@@ -189,7 +189,6 @@ CREATE TABLE IF NOT EXISTS content_cache (
sha TEXT NOT NULL,
title TEXT NOT NULL DEFAULT '',
date TEXT NOT NULL DEFAULT '',
- categories TEXT NOT NULL DEFAULT '',
-- Files carrying `translated_from` are the pipeline's output, not anyone's
-- draft. Recorded here so the listing can skip them without re-reading
-- every file to find out what it already knew.
@@ -245,10 +244,9 @@ CREATE TABLE IF NOT EXISTS submissions (
title TEXT NOT NULL,
body_md TEXT NOT NULL,
description TEXT NOT NULL DEFAULT '',
- categories TEXT NOT NULL DEFAULT '', -- comma-separated, as content_cache
- -- Set only when the proposal carries the Evento category. The event's own
- -- date, which is not the day it is published: a member announcing a concert
- -- three weeks out is the normal case.
+ -- The event's own date, which is also what makes this proposal an event at
+ -- all. It is not the day it is published: a member announcing a concert three
+ -- weeks out is the normal case.
event_date TEXT,
event_time TEXT,
event_location TEXT,
@@ -304,7 +302,7 @@ CREATE UNIQUE INDEX IF NOT EXISTS reactions_one_per_comment
-- Events the association puts on for its members: a meeting, a rehearsal, a
-- visit somewhere. Written by admins, read by every member, and never published
-- — nothing here reaches /var/www, the sitemap or a share card, which is the
--- difference between this table and a post with the Evento category.
+-- difference between this table and a public post carrying an event date.
--
-- `starts_on` and `starts_at` are kept apart rather than as one timestamp
-- because an event with no time is an ordinary thing ("the whole Saturday") and
diff --git a/apps/board/static/board.css b/apps/board/static/board.css
index 353941c..5ad5986 100644
--- a/apps/board/static/board.css
+++ b/apps/board/static/board.css
@@ -68,6 +68,10 @@ button, input, select, textarea { font: inherit; }
align-items: center;
justify-content: space-between;
gap: 1rem;
+ /* A long display name beside a logo has nowhere to go on a phone otherwise,
+ and `space-between` pushes the brand off the left edge rather than
+ wrapping. */
+ flex-wrap: wrap;
}
.site-bar__brand { text-decoration: none; }
@@ -84,7 +88,15 @@ button, input, select, textarea { font: inherit; }
padding: 0.6rem 16px;
list-style: none;
display: flex;
- gap: 1.5rem;
+ gap: 0.5rem 1.5rem;
+ /* Six sections and their badges do not fit across a phone. Without this the
+ row overflowed and took the whole page sideways with it — a members area
+ you had to scroll right to read.
+ Wrapping rather than a strip you swipe: two lines show all six, and a
+ horizontal scroll would have left Calendario and Gestión off the right
+ edge with nothing to say they were there. On a laptop it is one line
+ either way. */
+ flex-wrap: wrap;
}
.page-nav a { color: var(--muted); text-decoration: none; }
.page-nav a:hover { color: var(--brand); }
diff --git a/apps/board/submissions.py b/apps/board/submissions.py
index e575549..e0ffda5 100644
--- a/apps/board/submissions.py
+++ b/apps/board/submissions.py
@@ -92,17 +92,14 @@ def _read_proposal() -> tuple[dict, list[str]]:
"""The same fields the editor asks for, minus the ones only a publisher
decides: the date is the day it is approved, and `manual_translation` is a
pipeline switch, not something to explain to a member."""
- categories = [c for c in request.form.getlist("categories")
- if c in content.CATEGORIES]
errors = []
fields = {
"title": request.form.get("title", "").strip()[:TITLE_MAX],
"body": request.form.get("body", "").strip()[:BODY_MAX],
"description": request.form.get("description", "").strip()[:300],
- "categories": categories,
# The same three fields the editor asks for, read by the same function:
# a member's event and a moderator's have to produce the same post.
- **content.read_event_fields(request.form, categories, errors),
+ **content.read_event_fields(request.form, errors),
}
if not fields["title"]:
errors.append("El título no puede estar vacío.")
@@ -154,8 +151,7 @@ def propose():
return redirect(url_for("content.new", collection="post"))
if request.method == "GET":
- return render_template("submission_form.html", item=None, fields=None,
- categories=content.CATEGORIES)
+ return render_template("submission_form.html", item=None, fields=None)
fields, errors = _read_proposal()
waiting = get_db().execute(
@@ -179,11 +175,11 @@ def propose():
photo_name = _store_picture(staged)
get_db().execute(
"""INSERT INTO submissions
- (author_id, title, body_md, description, categories, photo_name,
+ (author_id, title, body_md, description, photo_name,
event_date, event_time, event_location)
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)""",
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?)""",
(g.member["id"], fields["title"], fields["body"], fields["description"],
- ", ".join(fields["categories"]), photo_name,
+ photo_name,
fields["event_date"], fields["event_time"], fields["event_location"]),
)
flash("Enviado. Un moderador lo leerá antes de publicarlo.", "ok")
@@ -217,12 +213,10 @@ def edit(submission_id: int):
return redirect(url_for("submissions.index"))
if request.method == "GET":
- return render_template("submission_form.html", item=row, categories=content.CATEGORIES,
+ return render_template("submission_form.html", item=row,
fields={
"title": row["title"], "body": row["body_md"],
"description": row["description"],
- "categories": [c.strip() for c in
- (row["categories"] or "").split(",") if c.strip()],
"event_date": row["event_date"] or "",
"event_time": row["event_time"] or "",
"event_location": row["event_location"] or "",
@@ -246,14 +240,14 @@ def edit(submission_id: int):
get_db().execute(
"""UPDATE submissions
- SET title = ?, body_md = ?, description = ?, categories = ?,
+ SET title = ?, body_md = ?, description = ?,
photo_name = ?, event_date = ?, event_time = ?,
event_location = ?, state = 'pending', note = NULL,
reviewed_by = NULL, reviewed_at = NULL,
updated_at = datetime('now')
WHERE id = ?""",
(fields["title"], fields["body"], fields["description"],
- ", ".join(fields["categories"]), photo_name, fields["event_date"],
+ photo_name, fields["event_date"],
fields["event_time"], fields["event_location"], submission_id),
)
# Back to pending on every edit, including one made after a rejection: a
@@ -320,7 +314,6 @@ def approve(submission_id: int):
# this and the URL carries it, so a proposal that waited a week should
# not arrive dated a week ago.
"date": date_type.today(),
- "categories": [c.strip() for c in (row["categories"] or "").split(",") if c.strip()],
"description": row["description"],
"image": "",
"manual_translation": False,
@@ -419,5 +412,4 @@ def _store_picture(staged: list[dict]) -> str | None:
def _back_to_form(item, fields, errors):
for message in errors:
flash(message, "error")
- return render_template("submission_form.html", item=item, fields=fields,
- categories=content.CATEGORIES), 400
+ return render_template("submission_form.html", item=item, fields=fields), 400
diff --git a/apps/board/templates/content_form.html b/apps/board/templates/content_form.html
index edb306e..f62d82d 100644
--- a/apps/board/templates/content_form.html
+++ b/apps/board/templates/content_form.html
@@ -66,26 +66,15 @@
{% endif %}
{% if collection == 'post' %}
-
-
- {# An event's own date, which is not the day the post goes up. Shown whenever
- a post can be written: ticking Evento above is what makes these required,
- checked on the server rather than hidden and shown with a script. #}
+ {# An event's own date, which is not the day the post goes up. The date is
+ also what makes this post an event: there is nothing to tick first, so
+ there is no way to say "this is an event" and then not say when. #}