diff --git a/fabcal/routers/frontend.py b/fabcal/routers/frontend.py index 19d9c6a..68950a5 100644 --- a/fabcal/routers/frontend.py +++ b/fabcal/routers/frontend.py @@ -39,5 +39,5 @@ async def generate_response(request: Request, template_name: str, **additional_c @router.get("/sidebar/embed.html", response_class=HTMLResponse) -async def embed_sidebar(request: Request): - return await generate_response(request, "sidebar/embed.html") +async def embed_sidebar(request: Request, max_days: int = None): + return await generate_response(request, "sidebar/embed.html", max_days=int(max_days)) diff --git a/templates/sidebar/includes/events-list.html b/templates/sidebar/includes/events-list.html index 03ed66d..151aa05 100644 --- a/templates/sidebar/includes/events-list.html +++ b/templates/sidebar/includes/events-list.html @@ -1,3 +1,7 @@ +{% if max_days %} +{% set grouped_events = grouped_events[:max_days] %} +{% endif %} + {% for start_date, events in grouped_events %}