Let a tasks widget have a custom on-panel name
Adds TaskWidgetConfig.name (migration 19, plain column add) shown at the top of the widget on the actual panel instead of the hardcoded "Tasks" header -- e.g. "Chores" or "Mom's list". The only widget type with its own on-panel title at all, since it's the only one where "which list is this" isn't already obvious from a calendar/photo/ whiteboard's own content. Threaded through calendar_render's _draw_tasks/_build_tasks/ render_tasks/render_tasks_preview_png as a `title` param (default "Tasks", truncated to fit -- a long custom name shouldn't be able to overflow the widget's box), the config-save endpoint (tasks_name, truncated server-side to a sane header length rather than rejected), and a new "Settings" section in the tasks dialog. Verified live in the browser: the name actually renders at the top of the real composited panel (not just the dialog preview, which stays gated on having a configured source), and persists correctly on both desktop and mobile. Full suite (196 tests) passes.
This commit is contained in:
@@ -23,7 +23,7 @@ from PIL import Image
|
||||
from sqlalchemy.orm import Session
|
||||
|
||||
from ..calendar_render import _build_tasks
|
||||
from ..models import Frame, Widget
|
||||
from ..models import Frame, TaskWidgetConfig, Widget
|
||||
from ..routers.common import get_or_refresh_tasks_for_widget
|
||||
|
||||
ACTION_LABELS: dict[str, str] = {}
|
||||
@@ -35,7 +35,8 @@ def render(db: Session, frame: Frame, widget: Widget, target_w: int, target_h: i
|
||||
identical note; every widget type's render() shares one call
|
||||
signature regardless of which ones actually care."""
|
||||
tasks = get_or_refresh_tasks_for_widget(db, frame, widget)
|
||||
return _build_tasks(tasks, target_w, target_h, frame.palette_rgb)
|
||||
cfg = db.get(TaskWidgetConfig, widget.id)
|
||||
return _build_tasks(tasks, target_w, target_h, frame.palette_rgb, cfg.name or "Tasks")
|
||||
|
||||
|
||||
ACTIONS: dict = {}
|
||||
|
||||
Reference in New Issue
Block a user