web: show a proper not found page on 404
This commit is contained in:
parent
aac67b3d4d
commit
1b674cbb44
@ -235,17 +235,19 @@ viewdataWithDateAndParams d q a p =
|
|||||||
-- | Gather data used by handlers and templates in the current request.
|
-- | Gather data used by handlers and templates in the current request.
|
||||||
getViewData :: Handler ViewData
|
getViewData :: Handler ViewData
|
||||||
getViewData = do
|
getViewData = do
|
||||||
|
mhere <- getCurrentRoute
|
||||||
|
case mhere of
|
||||||
|
Nothing -> return nullviewdata
|
||||||
|
Just here -> do
|
||||||
app <- getYesod
|
app <- getYesod
|
||||||
let opts@WebOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} = appOpts app
|
let opts@WebOpts{cliopts_=copts@CliOpts{reportopts_=ropts}} = appOpts app
|
||||||
today <- liftIO getCurrentDay
|
today <- liftIO getCurrentDay
|
||||||
(j, merr) <- getCurrentJournal app copts{reportopts_=ropts{no_elide_=True}} today
|
(j, merr) <- getCurrentJournal app copts{reportopts_=ropts{no_elide_=True}} today
|
||||||
lastmsg <- getLastMessage
|
lastmsg <- getLastMessage
|
||||||
let msg = maybe lastmsg (Just . toHtml) merr
|
let msg = maybe lastmsg (Just . toHtml) merr
|
||||||
Just here <- getCurrentRoute
|
|
||||||
q <- getParameterOrNull "q"
|
q <- getParameterOrNull "q"
|
||||||
a <- getParameterOrNull "a"
|
a <- getParameterOrNull "a"
|
||||||
p <- getParameterOrNull "p"
|
p <- getParameterOrNull "p"
|
||||||
|
|
||||||
-- sidebar visibility: show it, unless there is a showsidebar cookie
|
-- sidebar visibility: show it, unless there is a showsidebar cookie
|
||||||
-- set to "0", or a ?sidebar=0 query parameter.
|
-- set to "0", or a ?sidebar=0 query parameter.
|
||||||
msidebarparam <- lookupGetParam "sidebar"
|
msidebarparam <- lookupGetParam "sidebar"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user