summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Smeding <tom@tomsmeding.com>2026-06-28 20:03:58 +0200
committerTom Smeding <tom@tomsmeding.com>2026-06-28 20:03:58 +0200
commitc257e36ab92460b36879f9a8fdef99ff722b2695 (patch)
treeb1b4b87000425b9914946047dea4a36e6c656f5a
parentc96197768cb830e103764843b1f4f00013e349ab (diff)
Also show viewopts box on calendar-day pagesHEADmaster
-rw-r--r--pages/calendar-day.mustache5
-rw-r--r--src/Main.hs15
-rw-r--r--src/Pages.hs2
3 files changed, 17 insertions, 5 deletions
diff --git a/pages/calendar-day.mustache b/pages/calendar-day.mustache
index da6f788..f0db7ab 100644
--- a/pages/calendar-day.mustache
+++ b/pages/calendar-day.mustache
@@ -17,6 +17,11 @@
</header>
<main>
<h1>Logs on {{date}} ({{network}}/{{channel}})</h1>
+ <div class="viewopts">
+ View:
+ {{^efAll}}<a href="?ef=all">{{/efAll}}All{{^efAll}}</a>{{/efAll}}&nbsp;
+ {{^efCompr}}<a href="?ef=compr">{{/efCompr}}Compressed{{^efCompr}}</a>{{/efCompr}}
+ </div>
<table id="events"><tbody>
{{#events}}
<tr{{#classlist}} class="{{&.}}"{{/classlist}}>
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 ()]
}