@@ -36,31 +36,34 @@ mkYesod "ElmTest" [parseRoutes|
36-- generateWidget is called with the result of an Elm QuasiQuoter (which is just a
36-- generateWidget is called with the result of an Elm QuasiQuoter (which is just a
37-- string containing some Elm code, with proper newline escaping)
37-- string containing some Elm code, with proper newline escaping)
38getMouseR :: Handler RepHtml
38getMouseR :: Handler RepHtml
40+ widget <- elmWidget mousePage
39−getMouseR = defaultLayout $ do
41+ defaultLayout $ do
40− setTitle "Mouse position demo"
42+ setTitle "Mouse position demo"
41− elmWidget mousePage
43+ widget
43getClockR :: Handler RepHtml
45getClockR :: Handler RepHtml
47+ widget <- elmWidget clockPage
44−getClockR = defaultLayout $ do
48+ defaultLayout $ do
45− setTitle "A clock"
49+ setTitle "A clock"
46− elmWidget clockPage
50+ widget
48getShapesR :: Handler RepHtml
52getShapesR :: Handler RepHtml
54+ widget <- elmWidget shapesPage
49−getShapesR = defaultLayout $ do
55+ defaultLayout $ do
50− setTitle "Simple shapes"
56+ setTitle "Simple shapes"
51− elmWidget shapesPage
57+ widget
53-- URLs are rendered manually and then passed on to the function containing
59-- URLs are rendered manually and then passed on to the function containing
54-- the elm QuasiQuoter.
60-- the elm QuasiQuoter.
55getRootR :: Handler RepHtml
61getRootR :: Handler RepHtml
56getRootR = do
62getRootR = do
57− render <- getUrlRender
63+ widget <- elmWidget $(elmFile "elm_source/index.elm")
58 defaultLayout $ do
64 defaultLayout $ do
59− let mouse = render MouseR
60− clock = render ClockR
61− shapes = render ShapesR
62 setTitle "Welcome!"
65 setTitle "Welcome!"
63− elmWidget $(elmFile "elm_source/index.elm")
66+ widget
66-- Our Yesod instance contains the default layout, which inserts the elm-min.js
69-- Our Yesod instance contains the default layout, which inserts the elm-min.js