diff options
author | Joris | 2016-07-14 11:57:12 +0000 |
---|---|---|
committer | Joris | 2016-07-14 12:00:05 +0000 |
commit | 69e69017b75d1cdaa1fd2aef2818de5111b29735 (patch) | |
tree | 99dba8f67dc1c55b2cc22f33f81c59c7355b337b /src/View/Html | |
parent | 04f9a66c66ca137d9fee6ccca228c41fec960fe0 (diff) |
Update code and fix parsers
Diffstat (limited to 'src/View/Html')
-rw-r--r-- | src/View/Html/Ad.hs | 48 | ||||
-rw-r--r-- | src/View/Html/Design.hs | 1 |
2 files changed, 24 insertions, 25 deletions
diff --git a/src/View/Html/Ad.hs b/src/View/Html/Ad.hs index 2d6bdb5..d8a3bae 100644 --- a/src/View/Html/Ad.hs +++ b/src/View/Html/Ad.hs @@ -7,8 +7,7 @@ module View.Html.Ad import Data.Text (Text) import qualified Data.Text as T import Data.Text.Lazy (toStrict) -import Data.Maybe (fromMaybe, catMaybes) -import Data.String (fromString) +import Data.Maybe (catMaybes) import Data.List (intersperse) import Data.Map (Map) import qualified Data.Map as M @@ -20,39 +19,40 @@ import qualified Text.Blaze.Html5.Attributes as A import Text.Blaze.Html.Renderer.Text (renderHtml) import Text.Blaze.Internal (textValue) -import Model.Ad -import qualified Model.Ad as A +import Model.Ad (Ad) +import qualified Model.Ad as Ad import Model.Resume (Resume) -import qualified Model.Resume as R +import qualified Model.Resume as Resume import Model.Detail (Detail) -import qualified Model.Detail as D +import qualified Model.Detail as Detail import Model.URL -import Model.Config +import Conf (Conf) +import qualified Conf import View.Html.Design -renderAds :: Config -> [Ad] -> Text -renderAds config = toStrict . renderHtml . (adsHtml config) +renderAds :: Conf -> [Ad] -> Text +renderAds conf = toStrict . renderHtml . (adsHtml conf) -adsHtml :: Config -> [Ad] -> Html -adsHtml config ads = do mapM_ (adHtml config) ads +adsHtml :: Conf -> [Ad] -> Html +adsHtml conf ads = do mapM_ (adHtml conf) ads -adHtml :: Config -> Ad -> Html -adHtml config ad = - let resume = A.resume ad - detail = A.detail ad +adHtml :: Conf -> Ad -> Html +adHtml conf ad = + let resume = Ad.resume ad + detail = Ad.detail ad in do resumeHtml resume - detailHtml config detail + detailHtml conf detail resumeHtml :: Resume -> Html resumeHtml resume = do H.h1 $ do - (toHtml . R.name $ resume) - case R.price resume of + (toHtml . Resume.name $ resume) + case Resume.price resume of Just price -> H.span ! A.class_ "price" @@ -60,17 +60,17 @@ resumeHtml resume = do $ toHtml price Nothing -> H.span "" - linkHtml (R.url resume) + linkHtml (Resume.url resume) -detailHtml :: Config -> Detail -> Html -detailHtml config detail = do - propertiesHtml (properties config) (D.properties detail) - case D.description detail of +detailHtml :: Conf -> Detail -> Html +detailHtml conf detail = do + propertiesHtml (Conf.properties conf) (Detail.properties detail) + case Detail.description detail of Just description -> descriptionHtml description Nothing -> H.div "" - mapM_ imageLinkHtml (D.images detail) + mapM_ imageLinkHtml (Detail.images detail) propertiesHtml :: [Text] -> Map Text Text -> Html propertiesHtml keys properties = diff --git a/src/View/Html/Design.hs b/src/View/Html/Design.hs index c33d991..6ef5659 100644 --- a/src/View/Html/Design.hs +++ b/src/View/Html/Design.hs @@ -8,7 +8,6 @@ module View.Html.Design import Data.Text.Lazy (Text) import qualified Data.Text.Lazy as T -import Data.Monoid ((<>)) import Clay |