Skip to content

Commit

Permalink
Update Hierarchical-routes-and-breadcrumbs.md
Browse files Browse the repository at this point in the history
Changed RepHtml to Html
Changed  myLayout :: GWidget s App () -> GHandler s App RepHtml
   to myLayout :: Widget -> Handler Html
Changed hamletToRepHtml to withUrlRenderer
  • Loading branch information
teuffy committed Feb 25, 2017
1 parent 4bdd0a1 commit f2c539f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions cookbook/Hierarchical-routes-and-breadcrumbs.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ instance YesodBreadcrumbs App where
breadcrumb (UKR UKRootR) = return ("UK", Just RootR)
breadcrumb (AdminR AdminRootR) = return ("Admin", Just RootR)

getRootR :: Handler RepHtml
getRootR :: Handler Html
getRootR = defaultLayout [whamlet|$newline never
<h1>Homepage
<p>
Expand All @@ -61,32 +61,33 @@ getRootR = defaultLayout [whamlet|$newline never
\.
|]

getAdminRootR :: Handler RepHtml
getAdminRootR :: Handler Html
getAdminRootR = do
defaultLayout $ do
[whamlet|$newline never
<h1>Admin
|]

getNLRootR :: Handler RepHtml
getNLRootR :: Handler Html
getNLRootR = do
defaultLayout $ do
[whamlet|$newline never
<h1>NL
|]

getUKRootR :: Handler RepHtml
getUKRootR :: Handler Html
getUKRootR = do
defaultLayout $ do
[whamlet|$newline never
<h1>UK
|]

myLayout :: GWidget s App () -> GHandler s App RepHtml
--myLayout :: GWidget s App () -> GHandler s App RepHtml
myLayout :: Widget -> Handler Html
myLayout widget = do
(title, parents) <- breadcrumbs
pc <- widgetToPageContent widget
hamletToRepHtml [hamlet|$newline never
withUrlRenderer [hamlet|$newline never
$doctype 5
<html>
<head>
Expand Down Expand Up @@ -118,5 +119,5 @@ $doctype 5
^{pageBody pc}
|]

main = warpDebug 3000 $ App
```
main = warp 3000 $ App
```

0 comments on commit f2c539f

Please sign in to comment.