From c81b86202a02f2c4963bcb852e916cc7f2c86cf3 Mon Sep 17 00:00:00 2001 From: Chris Done Date: Sat, 8 Mar 2014 06:05:34 +0100 Subject: [PATCH] Placeholders for wiki and report --- config/routes | 2 ++ src/Blaze/Senza.hs | 6 ++++++ src/HL/Controller/Report.hs | 10 ++++++++++ src/HL/Controller/Wiki.hs | 12 ++++++++++++ src/HL/Dispatch.hs | 10 ++++++---- src/HL/Foundation.hs | 1 + src/HL/View/Documentation.hs | 31 ++++++++++++++++++++++++++++--- src/HL/View/Report.hs | 23 +++++++++++++++++++++++ src/HL/View/Template.hs | 3 ++- src/HL/View/Theme.hs | 2 +- src/HL/View/Wiki.hs | 25 +++++++++++++++++++++++++ 11 files changed, 116 insertions(+), 9 deletions(-) create mode 100644 src/HL/Controller/Report.hs create mode 100644 src/HL/Controller/Wiki.hs create mode 100644 src/HL/View/Report.hs create mode 100644 src/HL/View/Wiki.hs diff --git a/config/routes b/config/routes index 403163f..0e02ae5 100644 --- a/config/routes +++ b/config/routes @@ -6,3 +6,5 @@ /community CommunityR GET /documentation DocumentationR GET /news NewsR GET +/report/#Int ReportR GET +/wiki/#Text WikiR GET diff --git a/src/Blaze/Senza.hs b/src/Blaze/Senza.hs index 6f8324b..9d669e8 100644 --- a/src/Blaze/Senza.hs +++ b/src/Blaze/Senza.hs @@ -65,3 +65,9 @@ li = with E.li p :: [E.Attribute] -> Html -> Html p = with E.p + +pre :: [E.Attribute] -> Html -> Html +pre = with E.pre + +code :: [E.Attribute] -> Html -> Html +code = with E.code diff --git a/src/HL/Controller/Report.hs b/src/HL/Controller/Report.hs new file mode 100644 index 0000000..2fc341f --- /dev/null +++ b/src/HL/Controller/Report.hs @@ -0,0 +1,10 @@ +-- | Report page controller. + +module HL.Controller.Report where + +import HL.Foundation +import HL.View.Report + +-- | Report controller. +getReportR :: Int -> Handler Html +getReportR year = blaze reportV diff --git a/src/HL/Controller/Wiki.hs b/src/HL/Controller/Wiki.hs new file mode 100644 index 0000000..01e7111 --- /dev/null +++ b/src/HL/Controller/Wiki.hs @@ -0,0 +1,12 @@ +-- | Wiki page controller. + +module HL.Controller.Wiki where + +import HL.Foundation +import HL.View.Wiki + +import Data.Text (Text) + +-- | Wiki controller. +getWikiR :: Text -> Handler Html +getWikiR name = blaze wikiV diff --git a/src/HL/Dispatch.hs b/src/HL/Dispatch.hs index 131b112..8aca49a 100644 --- a/src/HL/Dispatch.hs +++ b/src/HL/Dispatch.hs @@ -5,13 +5,15 @@ module HL.Dispatch () where -import HL.Controller.Home -import HL.Controller.Reload -import HL.Controller.Theme -import HL.Controller.Downloads import HL.Controller.Community import HL.Controller.Documentation +import HL.Controller.Downloads +import HL.Controller.Home import HL.Controller.News +import HL.Controller.Reload +import HL.Controller.Report +import HL.Controller.Theme +import HL.Controller.Wiki import HL.Foundation mkYesodDispatch "App" resourcesApp diff --git a/src/HL/Foundation.hs b/src/HL/Foundation.hs index c0fcda2..061645a 100644 --- a/src/HL/Foundation.hs +++ b/src/HL/Foundation.hs @@ -18,6 +18,7 @@ module HL.Foundation import HL.Static import Control.Concurrent.Chan +import Data.Text (Text) import Network.Wai.Logger import System.Log.FastLogger import Yesod diff --git a/src/HL/View/Documentation.hs b/src/HL/View/Documentation.hs index 785fdd5..f8b97d5 100644 --- a/src/HL/View/Documentation.hs +++ b/src/HL/View/Documentation.hs @@ -16,10 +16,35 @@ documentationV :: Blaze App documentationV = template [(DocumentationR,"Documentation")] - (\_ -> + (\url -> container (row (span12 (do h1 [] "Documentation" - h2 [] "Online Resources" - p [] "Some stuff here.")))) + online url + report url)))) + +online url = + do h2 [] "Online Resources" + p [] "There are various online resources for learning Haskell; books, \ + \articles, videos, etc. below are some of the highlights:" + + +report url = + do h2 [] "Language Report" + p [] + (do "The Haskell 2010 language report is available online " + a [href (url (ReportR 2010))] + "here" + ".") + p [] + (do "A PDF version is available " + a [href "http://haskell.org/definition/haskell2010.pdf"] + "here" + ".") + p [] + "It can also be downloaded as a darcs repository: " + p [] + (pre [] + (code [] + "$ darcs get http://darcs.haskell.org/haskell2010-report")) diff --git a/src/HL/View/Report.hs b/src/HL/View/Report.hs new file mode 100644 index 0000000..43ca1c6 --- /dev/null +++ b/src/HL/View/Report.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE NoImplicitPrelude #-} + +-- | Report page view. + +module HL.View.Report where + +import HL.Foundation +import HL.View.Template + +import Blaze.Prelude +import Blaze.Bootstrap + +-- | Report view. +reportV :: Blaze App +reportV = + template + [(ReportR 2010,"Report")] + (\url -> + container + (row + (span12 + (do p [] "Insert report here.")))) diff --git a/src/HL/View/Template.hs b/src/HL/View/Template.hs index 2b11ac1..95092d3 100644 --- a/src/HL/View/Template.hs +++ b/src/HL/View/Template.hs @@ -69,7 +69,8 @@ navigation cur url = [(DownloadsR,"Downloads") ,(CommunityR,"Community") ,(DocumentationR,"Documentation") - ,(NewsR,"News")])) + ,(NewsR,"News") + ,(WikiR "","Wiki")])) where item route title = li theclass (a [href (url route)] title) where theclass | Just route == cur = [class_ "active"] diff --git a/src/HL/View/Theme.hs b/src/HL/View/Theme.hs index 4ee0fba..0baa77b 100644 --- a/src/HL/View/Theme.hs +++ b/src/HL/View/Theme.hs @@ -30,7 +30,7 @@ main = rule ".wrap" (do background "#ffffff" paddingBottom "2em") - rule "p" + rule "p,ul,li" (do fontSize "15px") rule "h1" (do marginTop "0.1em" diff --git a/src/HL/View/Wiki.hs b/src/HL/View/Wiki.hs new file mode 100644 index 0000000..9a694d8 --- /dev/null +++ b/src/HL/View/Wiki.hs @@ -0,0 +1,25 @@ +{-# LANGUAGE OverloadedStrings #-} +{-# LANGUAGE NoImplicitPrelude #-} + +-- | Wiki page view. + +module HL.View.Wiki where + +import HL.Foundation +import HL.View.Template + +import Blaze.Prelude +import Blaze.Bootstrap + +-- | Wiki view. +wikiV :: Blaze App +wikiV = + template + [(WikiR "","Wiki")] + (\_ -> + container + (row + (span12 + (do h1 [] "Wiki" + p [] + "Insert wiki here."))))