From 515660fa7deeeb6753768378e0cfa38a4616e03a Mon Sep 17 00:00:00 2001 From: Vincent Ambo Date: Sun, 18 Mar 2012 23:47:13 +0100 Subject: * fixed 404 page --- src/Blog.hs | 7 ++++++- src/Locales.hs | 9 +++++++++ src/Main.hs | 2 ++ 3 files changed, 17 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/Blog.hs b/src/Blog.hs index 5914052f932e..d6b806985ed6 100644 --- a/src/Blog.hs +++ b/src/Blog.hs @@ -237,4 +237,9 @@ editPage (Entry{..}) = adminTemplate "Index" $ -- Error pages showError :: BlogError -> BlogLang -> Html -showError NotFound l = undefined +showError NotFound l = blogTemplate l (T.append ": " $ notFound l) $ + H.div ! A.class_ "innerBox" $ do + H.div ! A.class_ "innerBoxTop" $ toHtml $ notFound l + H.div ! A.class_ "innerBoxMiddle" $ do + H.p ! A.class_ "notFoundFace" $ toHtml (":'(" :: Text) + H.p ! A.class_ "notFoundText" $ toHtml $ notFoundText l diff --git a/src/Locales.hs b/src/Locales.hs index 9330fd81fb9b..c1dc02453c12 100644 --- a/src/Locales.hs +++ b/src/Locales.hs @@ -115,6 +115,15 @@ cSend :: BlogLang -> Text cSend DE = "Absenden" cSend EN = "Submit" +-- errors +notFound :: BlogLang -> Text +notFound DE = "Nicht gefunden" +notFound EN = "Not found" + +notFoundText :: BlogLang -> Text +notFoundText DE = "Das gewünschte Objekt wurde leider nicht gefunden." +notFoundText EN = "The requested object could unfortunately not be found." + -- right side text (this is inserted AS IS. Escape HTML!) rightText :: BlogLang -> Text rightText DE = "English version available here." diff --git a/src/Main.hs b/src/Main.hs index 84fa0d9dd326..f12c74349414 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -74,6 +74,7 @@ tazBlog acid = , dir "admin" $ ok $ toResponse $ adminLogin , dir "dologin" $ processLogin acid , serveDirectory DisableBrowsing [] "../res" + , ok $ toResponse $ showError NotFound DE ] blogHandler :: AcidState Blog -> BlogLang -> ServerPart Response @@ -84,6 +85,7 @@ blogHandler acid lang = \(eId :: Integer) -> addComment acid lang $ EntryId eId , do nullDir showIndex acid lang + , ok $ toResponse $ showError NotFound lang ] formatOldLink :: Int -> Int -> String -> ServerPart Response -- cgit 1.4.1