-
Notifications
You must be signed in to change notification settings - Fork 0
/
Foundation.hs
38 lines (27 loc) · 1 KB
/
Foundation.hs
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
module Foundation where
import Import.NoFoundation
import Text.Hamlet (hamletFile)
import Yesod.Core.Types (Logger)
data App = App
{ appSettings :: AppSettings
, appStatic :: Static
, appLogger :: Logger
}
mkYesodData "App" $(parseRoutesFile "config/routes")
type Form x = Html -> MForm (HandlerT App IO) (FormResult x, Widget)
instance Yesod App where
approot = ApprootMaster $ appRoot . appSettings
defaultLayout widget = do
master <- getYesod
mmsg <- getMessage
pc <- widgetToPageContent $ do
addStylesheet $ StaticR css_bootstrap_css
$(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
shouldLog app _source level =
appShouldLogAll (appSettings app)
|| level == LevelWarn
|| level == LevelError
makeLogger = return . appLogger
instance RenderMessage App FormMessage where
renderMessage _ _ = defaultFormMessage