From a29a34d41f3101344b46f51a8e5dc5afecf82218 Mon Sep 17 00:00:00 2001 From: "\"Vincent Ambo ext:(%22)" Date: Fri, 24 Feb 2012 05:20:36 +0100 Subject: * I fixed the front page --- src/Blog.hs | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'src/Blog.hs') diff --git a/src/Blog.hs b/src/Blog.hs index 80d6c45871c1..e22a8d9efed8 100644 --- a/src/Blog.hs +++ b/src/Blog.hs @@ -4,6 +4,7 @@ module Blog where --import Control.Monad(when) import Data.Data (Data, Typeable) +import Data.List (intersperse) import Data.Monoid (mempty) import Data.Time import System.Locale (defaultTimeLocale) @@ -61,6 +62,7 @@ blogTemplate title ctext1 ortext version lang body = H.docTypeHtml $ do --add bo -- H.span ! A.id "cios" ! A.style "display:none;" $ H.b $ contactInfo "sms:tazjin@me.com" H.div ! A.class_ "myclear" $ mempty body + H.div ! A.class_ "myclear" $ mempty showFooter lang version H.div ! A.class_ "centerbox" $ H.img ! A.src "http://getpunchd.com/img/june/idiots.png" ! A.alt "" @@ -74,6 +76,21 @@ blogTemplate title ctext1 ortext version lang body = H.docTypeHtml $ do --add bo H.a ! A.href (toValue imu) ! A.target "_blank" $ "iMessage" "." +renderEntries :: [Entry] -> Int -> String-> Html +renderEntries entries num topText = H.div ! A.class_ "innerBox" $ do + H.div ! A.class_ "innerBoxTop" $ toHtml topText + H.div ! A.class_ "innerBoxMiddle" $ do + H.ul $ + sequence_ $ take num $ reverse $ map showEntry entries + where + showEntry :: Entry -> Html + showEntry e = H.li $ do + entryLink e + preEscapedString $ " " ++ (text e) ++ "
 
" + entryLink e = H.a ! A.href (toValue $ concat $ intersperse "/" $ linkElems e) $ + toHtml ("[" ++ show(length $ comments e) ++ "]") + linkElems e = [show(lang e), show(year e), show(month e), show(day e), _id e] + renderEntry :: Entry -> Html renderEntry entry = H.div ! A.class_ "innerBox" $ do H.div ! A.class_ "innerBoxTop" $ toHtml $ title entry @@ -102,12 +119,10 @@ renderComments comments lang = sequence_ $ map showComment comments getTime :: Integer -> Maybe UTCTime getTime t = parseTime defaultTimeLocale "%s" (show t) showTime DE (Just t) = formatTime defaultTimeLocale "[Am %d.%m.%y um %H:%M Uhr]" t - showTime EN (Just t) = formatTime defaultTimeLocale "[On %D at %H:%M Uhr]" t + showTime EN (Just t) = formatTime defaultTimeLocale "[On %D at %H:%M]" t showTime _ Nothing = "[???]" -- this can not happen?? timeString = (showTime lang) . getTime ---[Am %d.%m.%y um %H:%M Uhr] - emptyTest :: BlogLang -> Html emptyTest lang = H.div ! A.class_ "innerBox" $ do H.div ! A.class_ "innerBoxTop" $ "Test" -- cgit 1.4.1