bamboo-2009.6.9: src/Bamboo/Controller/Index.hs
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE NamedFieldPuns #-}
module Bamboo.Controller.Index where
import Bamboo.Controller.Env
index :: Controller
index = do
init_state
(posts, pager) <- list.io >>= (mapM init_post_meta_data) >>= paged
let nav_location = if pager.current == 1 then home_nav else no_navigation
s <- get
put s
{ uid = s.config.post_id
, pager
, nav_location
, posts }
index_feed :: Controller
index_feed = do
s <- get
posts <- list .io ^ take (s.config.number_of_latest_posts)
put s { posts }