mirror of
https://github.com/gren-lang/compiler.git
synced 2024-10-27 10:19:02 +03:00
* updated elm-yesod Example to use variable interpolation for URLs
This commit is contained in:
parent
fd1b410ea4
commit
6b2b4180ad
@ -13,7 +13,7 @@ data ElmTest = ElmTest
|
||||
-- embedding an external elm file (note: no spaces!)
|
||||
mousePage = [elmFile|elm_source/mouse.elm|]
|
||||
|
||||
rootPage = [elmFile|elm_source/index.elm|]
|
||||
rootPage mouse clock shapes = [elmFile|elm_source/index.elm|]
|
||||
|
||||
clockPage = [elmFile|elm_source/clock.elm|]
|
||||
|
||||
@ -55,10 +55,17 @@ getShapesR = defaultLayout $ do
|
||||
setTitle "Simple shapes"
|
||||
generateWidget shapesPage
|
||||
|
||||
-- URLs are rendered manually and then passed on to the function containing
|
||||
-- the elm QuasiQuoter.
|
||||
getRootR :: Handler RepHtml
|
||||
getRootR = defaultLayout $ do
|
||||
setTitle "Welcome!"
|
||||
generateWidget rootPage
|
||||
getRootR = do
|
||||
render <- getUrlRender
|
||||
defaultLayout $ do
|
||||
let mouse = render MouseR
|
||||
clock = render ClockR
|
||||
shapes = render ShapesR
|
||||
setTitle "Welcome!"
|
||||
generateWidget $ rootPage mouse clock shapes
|
||||
|
||||
|
||||
-- Our Yesod instance contains the default layout, which inserts the elm-min.js
|
||||
|
@ -26,9 +26,9 @@ info w = List.map (\f -> f ()) . List.intersperse (\x -> plainText " ") . L
|
||||
, text $ toText "Rendering Yesod's type-safe URLs is not yet possible, but will be implemented as the currently " ++
|
||||
toText "very simple QuasiQuoter is extended."
|
||||
, section "More examples:"
|
||||
, text $ toText "- " ++ link "/mouse" (toText "A simple mouse input example")
|
||||
, text $ toText "- " ++ link "/clock" (toText "An animated analog clock")
|
||||
, text $ toText "- " ++ link "/shapes" (toText "Some simple rendered shapes")
|
||||
, text $ toText "- " ++ link ^{mouse} (toText "A simple mouse input example")
|
||||
, text $ toText "- " ++ link ^{clock} (toText "An animated analog clock")
|
||||
, text $ toText "- " ++ link ^{shapes} (toText "Some simple rendered shapes")
|
||||
]
|
||||
|
||||
body outer inner = width outer . box 2 . flow down . (:) (plainText " ") $ info inner
|
||||
|
Loading…
Reference in New Issue
Block a user