aboutsummaryrefslogtreecommitdiff
path: root/src/server/View/Page.hs
blob: e85ed33e4d3c41f0067096570d3a751c5c13103f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
{-# LANGUAGE OverloadedStrings #-}

module View.Page
  ( page
  ) where

import Data.Text.Internal.Lazy (Text)
import Data.Text.Lazy.Encoding (decodeUtf8)
import Data.Aeson (encode)

import Text.Blaze.Html
import Text.Blaze.Html5
import qualified Text.Blaze.Html5 as H
import Text.Blaze.Html5.Attributes
import qualified Text.Blaze.Html5.Attributes as A
import Text.Blaze.Html.Renderer.Text (renderHtml)

import Design.Global (globalDesign)

import Model.Message
import Model.Json.Config
import Model.Message.Key (Key(SharedCost))

page :: Config -> Text
page config =
  renderHtml . docTypeHtml $ do
    H.head $ do
      meta ! charset "UTF-8"
      meta ! httpEquiv "X-UA-Compatible" ! content "IE=Edge" -- IE8+ only is valid to use with persona
      H.title (toHtml $ getMessage SharedCost)
      script ! src "https://login.persona.org/include.js" $ ""
      script ! src "javascripts/client.js" $ ""
      script ! A.id "messages" ! type_ "application/json" $ toHtml . decodeUtf8 . encode $ getTranslations
      script ! A.id "config" ! type_ "application/json" $ toHtml . decodeUtf8 . encode $ config
      link ! rel "stylesheet" ! type_ "text/css" ! href "css/reset.css"
      link ! rel "stylesheet" ! href "css/font-awesome-4.5.0/css/font-awesome.min.css"
      link ! rel "icon" ! type_ "image/png" ! href "images/icon.png"
      H.style $ toHtml globalDesign
    body $ do
      script ! src "javascripts/main.js" $ ""