From c257e36ab92460b36879f9a8fdef99ff722b2695 Mon Sep 17 00:00:00 2001 From: Tom Smeding Date: Sun, 28 Jun 2026 19:03:58 +0100 Subject: Also show viewopts box on calendar-day pages --- src/Main.hs | 15 ++++++++++----- src/Pages.hs | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/Main.hs b/src/Main.hs index cb4e1fb..78098af 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -140,10 +140,11 @@ pageCalendarDay conf index req alias datestr = (Nothing, _) -> sendText404 "Channel not found" (_, Nothing) -> sendText404 "Invalid date" (Just chan, Just day) -> do - let kind = case query req "ef" of - Just "all" -> CKAll - Just "compr" -> CKCompressed - _ -> CKAll + let (kind, kindCookie) = + case query req "ef" <|> cookie req "ef" of -- event filter + Just "all" -> (CKAll, Just "ef=all; Path=/") + Just "compr" -> (CKCompressed, Just "ef=compr; Path=/") + _ -> (CKAll, Nothing) events <- indexGetEventsDay index chan kind day mpagehighlight <- if | Just (TE.decodeASCII' -> Just eventID) <- query req "eid" -> do @@ -155,11 +156,15 @@ pageCalendarDay conf index req alias datestr = _ -> return Nothing | otherwise -> return Nothing - sendHtml200 $ + let headers = [("Content-Type", "text/html")] ++ + maybe [] (\s -> [("Set-Cookie", s)]) kindCookie + return $ responseBS status200 headers $ renderPageCalendarDay CalendarDayData { network = chanNetwork chan , channel = chanChannel chan , alias = alias + , efAll = kind == CKAll + , efCompr = kind == CKCompressed , date = T.pack (ymdToString (dayToYMD day)) , events = [EventData diff --git a/src/Pages.hs b/src/Pages.hs index 7b114a6..1a076ec 100644 --- a/src/Pages.hs +++ b/src/Pages.hs @@ -69,6 +69,8 @@ data CalendarDayData = CalendarDayData { network :: Text , channel :: Text , alias :: Text + , efAll :: Bool + , efCompr :: Bool , date :: Text , events :: [EventData Text ()] } -- cgit v1.3.1