Move CSS rendering into the base template
This commit is contained in:
parent
0b1489f00e
commit
03714a8b46
|
@ -3,7 +3,6 @@
|
||||||
|
|
||||||
module Main where
|
module Main where
|
||||||
|
|
||||||
import qualified Clay (render)
|
|
||||||
import Control.Monad.IO.Class
|
import Control.Monad.IO.Class
|
||||||
import qualified Data.Map as Map
|
import qualified Data.Map as Map
|
||||||
import qualified Data.Text as Text
|
import qualified Data.Text as Text
|
||||||
|
@ -14,7 +13,6 @@ import qualified Network.Wai.Middleware.Static as Static
|
||||||
import Text.Blaze.Renderer.Text
|
import Text.Blaze.Renderer.Text
|
||||||
import Web.Spock ((<//>))
|
import Web.Spock ((<//>))
|
||||||
import qualified Web.Spock as S
|
import qualified Web.Spock as S
|
||||||
import qualified Within.DBMemorial.CSS.Base as CSSBase
|
|
||||||
import qualified Within.DBMemorial.Post as Post
|
import qualified Within.DBMemorial.Post as Post
|
||||||
import qualified Within.DBMemorial.User as User
|
import qualified Within.DBMemorial.User as User
|
||||||
import qualified Within.DBMemorial.Views.Materialize as Materialize
|
import qualified Within.DBMemorial.Views.Materialize as Materialize
|
||||||
|
@ -38,10 +36,6 @@ main = do
|
||||||
S.middleware $ Static.staticPolicy $ Static.addBase "public"
|
S.middleware $ Static.staticPolicy $ Static.addBase "public"
|
||||||
S.middleware $ RequestLogger.logStdout
|
S.middleware $ RequestLogger.logStdout
|
||||||
|
|
||||||
-- CSS routes
|
|
||||||
S.get ("css" <//> "base.css") $
|
|
||||||
S.text $ toStrict $ Clay.render $ CSSBase.render
|
|
||||||
|
|
||||||
-- Test routes
|
-- Test routes
|
||||||
S.get S.root $
|
S.get S.root $
|
||||||
S.html $ toStrict (renderMarkup (Materialize.render "The OP" (Post.render h user)))
|
S.html $ toStrict (renderMarkup (Materialize.render "The OP" (Post.render h user)))
|
||||||
|
|
|
@ -2,12 +2,14 @@
|
||||||
|
|
||||||
module Within.DBMemorial.Views.Materialize where
|
module Within.DBMemorial.Views.Materialize where
|
||||||
|
|
||||||
|
import qualified Clay (render)
|
||||||
import Control.Monad (forM_)
|
import Control.Monad (forM_)
|
||||||
import Data.Monoid
|
import Data.Monoid
|
||||||
import Data.Text
|
import Data.Text
|
||||||
import Text.Blaze.Html
|
import Text.Blaze.Html
|
||||||
import Text.Blaze.Html5 as H
|
import Text.Blaze.Html5 as H
|
||||||
import Text.Blaze.Html5.Attributes as A
|
import Text.Blaze.Html5.Attributes as A
|
||||||
|
import qualified Within.DBMemorial.CSS.Base as CSSBase
|
||||||
|
|
||||||
render :: Text -> Html -> Html
|
render :: Text -> Html -> Html
|
||||||
render pageTitle inner =
|
render pageTitle inner =
|
||||||
|
@ -18,7 +20,9 @@ render pageTitle inner =
|
||||||
meta ! charset "utf-8"
|
meta ! charset "utf-8"
|
||||||
meta ! name "viewport" ! content "width=device-width, initial-scale=1.0"
|
meta ! name "viewport" ! content "width=device-width, initial-scale=1.0"
|
||||||
link ! rel "stylesheet" ! href "/materialize/css/materialize.min.css"
|
link ! rel "stylesheet" ! href "/materialize/css/materialize.min.css"
|
||||||
link ! rel "stylesheet" ! href "/css/base.css"
|
|
||||||
|
H.style $ H.toHtml $ Clay.render $ CSSBase.render
|
||||||
|
|
||||||
script ! type_ "text/javascript" ! src "https://code.jquery.com/jquery-2.1.1.min.js" $ mempty
|
script ! type_ "text/javascript" ! src "https://code.jquery.com/jquery-2.1.1.min.js" $ mempty
|
||||||
script ! src "/materialize/js/materialize.min.js" $ mempty
|
script ! src "/materialize/js/materialize.min.js" $ mempty
|
||||||
H.body $ do
|
H.body $ do
|
||||||
|
|
Loading…
Reference in New Issue