[the theme should provide a recent blog posts view Jeremy Shaw **20121125023807 Ignore-this: efdfe45dcae30e18c03b8e312f75a53f ] hunk ./clckwrks-theme-bootstrap/BootstrapTheme.hs 1 -{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} +{-# LANGUAGE FlexibleContexts, OverloadedStrings, RecordWildCards #-} hunk ./clckwrks-theme-bootstrap/BootstrapTheme.hs 16 + , themeBlog = blog hunk ./clckwrks-theme-bootstrap/BootstrapTheme.hs 43 + +postsHTML :: XMLGenT (Clck ClckURL) XML +postsHTML = + do posts <- getPosts +
    + <% mapM postHTML posts %> +
+ +postHTML :: Page -> XMLGenT (Clck ClckURL) XML +postHTML Page{..} = +
  • +

    <% pageTitle %>

    + <% pageDate %> + <% pageSrc %> +

    permalink

    +
  • + +blog :: XMLGenT (Clck ClckURL) XML +blog = + do ttl <- lift getBlogTitle + pageTemplate ttl () $ + <%> +
    +

    <% ttl %>

    + <% postsHTML %> +
    + hunk ./clckwrks-theme-clckwrks/Theme.hs 1 -{-# LANGUAGE FlexibleContexts, OverloadedStrings #-} +{-# LANGUAGE FlexibleContexts, OverloadedStrings, RecordWildCards #-} hunk ./clckwrks-theme-clckwrks/Theme.hs 16 + , themeBlog = blog hunk ./clckwrks-theme-clckwrks/Theme.hs 65 + +postsHTML :: XMLGenT (Clck ClckURL) XML +postsHTML = + do posts <- getPosts +
      + <% mapM postHTML posts %> +
    + +postHTML :: Page -> XMLGenT (Clck ClckURL) XML +postHTML Page{..} = +
  • +

    <% pageTitle %>

    + <% pageDate %> + <% pageSrc %> +

    permalink

    +
  • + +blog :: XMLGenT (Clck ClckURL) XML +blog = + do ttl <- lift getBlogTitle + pageTemplate ttl () $ + <%> +
    +

    <% ttl %>

    + <% postsHTML %> +
    + hunk ./clckwrks/Clckwrks/Monad.hs 114 + , themeBlog :: XMLGenT (ClckT ClckURL (ServerPartT IO)) XML hunk ./clckwrks/Clckwrks/Plugin.hs 78 -{- - (Blog) -> -- FIXME - do clckBlogHandler cc --} + + (Blog) -> + do p <- plugins <$> get + mTheme <- getTheme p + case mTheme of + Nothing -> escape $ internalServerError $ toResponse $ ("No theme package is loaded." :: Text) + (Just theme) -> fmap toResponse $ unXMLGenT $ themeBlog theme +