feat(signage): menu look part by part, board-only names, stack bar, Delete key (owner review 3)

- Menus (slides and widgets): headings / names / prices each with size,
  colour, font, bold / italic / underline and alignment; dots size, colour
  and style; line and letter spacing; photo size and shape (menuLook)
- Names aligned right end together, prices in a page-wide column
- Names for one board only (names, category_names) with a pencil on the
  board's list; the catalogue name stays for the waiters
- Fixed: menu lists inherited the page's fixed line height (big text
  overlapped); a menu slide's list grew past the screen (no 2nd column)
- Stacks: parts sized by dragging the lines on the bar; "Add a widget"
- Delete / Backspace removes the picked widget

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-11-21 10:51:03 +02:00
co-authored by Claude Opus 5.5
parent 1b993e4573
commit e8c8ec825e
16 changed files with 642 additions and 81 deletions
+14 -2
View File
@@ -87,9 +87,18 @@ def resolve(db, content: dict, now=None, keep_hidden: bool = False) -> dict:
def text(row, base, field):
return menu_languages.texts(base, menu_languages.of(row), field).get(lang, base) if lang else base
own = content.get("names") or {} # this board's own names (2026-11-21)
own_cats = content.get("category_names") or {}
def named(row, base, mine):
"""(the name shown, the catalogue's name when the board has its own)"""
shown = text(row, base, "name")
return (mine, shown) if mine else (shown, None)
def item(p):
image = media_store.image_of(p.media) if content.get("show_photos") else None
return {"id": p.id, "name": text(p, p.digital_name or p.name, "name"),
name, original = named(p, p.digital_name or p.name, own.get(str(p.id)))
return {"id": p.id, "name": name, **({"original": original} if original and keep_hidden else {}),
"description": text(p, p.digital_description or p.description or None, "description") if content.get("show_descriptions") else None,
"price": round(prices[p.id], 2) if p.id in prices else None,
"available": bool(p.is_available), "image": image["card"] if image else None,
@@ -99,7 +108,10 @@ def resolve(db, content: dict, now=None, keep_hidden: bool = False) -> dict:
groups: dict = {}
for p in products:
groups.setdefault(p.primary_category_id, []).append(p)
out = [{"category": {"id": cid, "name": text(by_id[cid], by_id[cid].name, "name")} if cid in by_id else None,
def cat(cid):
name, original = named(by_id[cid], by_id[cid].name, own_cats.get(str(cid)))
return {"id": cid, "name": name, **({"original": original} if original and keep_hidden else {})}
out = [{"category": cat(cid) if cid in by_id else None,
"items": [item(p) for p in sorted(ps, key=prod_key)]}
for cid, ps in sorted(groups.items(), key=lambda kv: cat_key(kv[0]))]
else: