web: show the sidebar by default (#310)

This commit is contained in:
Simon Michael 2016-01-25 09:08:19 -08:00
parent 6fb76d979f
commit ec87da8b04

View File

@ -229,7 +229,7 @@ viewdataWithDateAndParams d q a p =
,am = acctsmatcher ,am = acctsmatcher
,aopts = acctsopts ,aopts = acctsopts
,showpostings = p == "1" ,showpostings = p == "1"
,showsidebar = False ,showsidebar = True
} }
-- | Gather data used by handlers and templates in the current request. -- | Gather data used by handlers and templates in the current request.
@ -246,11 +246,11 @@ getViewData = do
a <- getParameterOrNull "a" a <- getParameterOrNull "a"
p <- getParameterOrNull "p" p <- getParameterOrNull "p"
-- a "sidebar" query parameter overrides the "showsidebar" cookie -- sidebar visibility: show it, unless there is a showsidebar cookie
sidebarparam <- lookupGetParam (pack "sidebar") -- set to "0", or a ?sidebar=0 query parameter.
cookies <- reqCookies <$> getRequest msidebarparam <- lookupGetParam "sidebar"
let sidebarcookie = lookup "showsidebar" cookies msidebarcookie <- reqCookies <$> getRequest >>= return . lookup "showsidebar"
let showsidebar = maybe (sidebarcookie == Just "1") (=="1") sidebarparam let showsidebar = maybe (msidebarcookie /= Just "0") (/="0") msidebarparam
return (viewdataWithDateAndParams today q a p){ return (viewdataWithDateAndParams today q a p){
opts=opts opts=opts