Commit ec1bf496 authored by Ibnu Daru Aji's avatar Ibnu Daru Aji

added templates.

parent b5892ef5
......@@ -2,7 +2,7 @@
--
-- see: https://github.com/sol/hpack
--
-- hash: af9d13db555581390fe9273f4721790b8f73e3e1653aa95d62e7653899693c62
-- hash: 08696098b1b731323e73e7ce93701cbb0163a441a1968de5ea78ab37d19644b7
name: Cirkeltrek
version: 0.0.0
......@@ -33,6 +33,7 @@ library
, persistent
, persistent-postgresql
, persistent-template
, shakespeare
, template-haskell
, wai
, wai-extra
......@@ -69,6 +70,7 @@ executable Cirkeltrek
, persistent
, persistent-postgresql
, persistent-template
, shakespeare
, template-haskell
, wai
, wai-extra
......
[email protected]:1523102271
\ No newline at end of file
......@@ -15,6 +15,7 @@ dependencies:
- persistent
- persistent-template
- persistent-postgresql
- shakespeare
- template-haskell
- yaml
- yesod
......
{-# LANGUAGE NoImplicitPrelude #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE QuasiQuotes #-}
{-# LANGUAGE RankNTypes #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE TypeFamilies #-}
module Foundation where
import ClassyPrelude
import ClassyPrelude.Yesod
import Database.Persist.Sql
import Network.HTTP.Client
import Text.Hamlet
import Yesod.Core
import Yesod.Core.Types
import Yesod.Form
import Yesod.Static
import Settings
......@@ -27,8 +34,26 @@ mkYesodData
/ HomeR GET
|]
type Form a = Html -> MForm (HandlerFor App) (FormResult a, Widget)
type DB a = forall (m :: * -> *). (MonadIO m) => ReaderT SqlBackend m a
instance Yesod App where
approot = ApprootRequest $ \app req ->
case appRoot $ appSettings app of
Nothing -> getApprootText guessApproot app req
Just root -> root
yesodMiddleware = defaultYesodMiddleware
defaultLayout widget = do
master <- getYesod
mmessage <- getMessage
mcurrentroute <- getCurrentRoute
pagecontent <- widgetToPageContent $ do
[whamlet|
$maybe route <- mcurrentroute
<p> You're at #{show route}.
$nothing
<p> You're lost.
^{widget}
|]
withUrlRenderer $(hamletFile "templates/wrapper.hamlet")
$newline never
\<!doctype html>
\<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
\<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
\<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
\<!--[if gt IE 8]><!-->
<html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="UTF-8">
<title>#{pageTitle pagecontent}
<meta name="description" content="">
<meta name="author" content="">
<meta name="viewport" content="width=device-width,initial-scale=1.0, user-scalable=yes">
^{pageHead pagecontent}
<body>
<main class="wrapper">
^{pageBody pagecontent}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment