panda-2008.9.19: Panda/View/Theme/BluePrint/Template/Body.hs
module Panda.View.Theme.BluePrint.Template.Body where
-- env
import Panda.Helper.Env
import Prelude hiding ((.), (/), (^), id, span)
import qualified Panda.Config.Global as G
import qualified Panda.Type.State as State
-- view
import Panda.View.Theme.BluePrint.Template.Sidebar
import Panda.View.Theme.BluePrint.Template.Footer
html_body state x = body << div_class "container" <<
[ body_header state
, div_id "page" << [ body_content x, html_sidebar state ]
, html_footer
]
body_header state = toHtml
[ div_class_id "column span-12 first" "header" <<
[ search_form
, site_name
]
, div_class_id "column span-12 first large" "nav" << navigation state
]
-- search_form = spaceHtml
search_form = div_id "search" << form ! [action "/search", method "get"] << thediv << textfield "s"
site_name = toHtml $
[ toHtml $ hotlink "/" ! [theclass "logo"] << ""
, h1 << G.blog_title
, div_class "description" << G.blog_subtitle
]
navigation state = div_class "content" <<
ulist << G.navigation.map (nav_item (state.State.nav_location))
nav_item nav s = li ! [theclass (home_tag ++ "page_item" ++ current)] << link s where
home_tag = if s == home_nav then "first " else ""
current = if s == nav then " current_page_item" else ""
link x = if x == home_nav then home_link else static_link x
home_link = hotlink "/" << home_nav
static_link s = hotlink ("/" / "static" / s) << s.dropExtension
body_content x = div_class_id "column span-9 first" "maincontent" <<
div_class "content" << x