[web-devel] [ Yesod ][ Newbie ][ Widgets ] Ways of adding app manu
ciemniewski.kamil at gmail.com
Fri Jul 1 15:43:21 CEST 2011
I'm trying to add to my "admin layout" main menu in Yesod.
Normally - doing it in Rails - I would create a partial
or helper and then use it in my layout file.
But here in Yesod - the concept of widgets seems
somewhat fereign to me. I don't quite get them.
In my Handler.Admin module I define:
adminLayout :: GWidget MyApp MyApp () -> GHandler MyApp MyApp RepHtml
adminLayout widget = do
mmsg <- getMessage
mroute <- getCurrentRoute
pc <- widgetToPageContent $ do
hamletToRepHtml $(hamletFile "admin/admin-layout")
then I define my widget ( all in the same file ):
mainMenu :: Widget ()
addWidget $(widgetFile "admin/_menu")
And finally in "admin/admin-layout.hamlet" I'm trying to render my menu:
All without a luck.. Compiler yells at me strange ( to me ) things:
Couldn't match expected type `GGWidget
MyApp (GHandler MyApp MyApp) ()'
with actual type `(url0 -> [(T.Text, T.Text)] -> T.Text)
Expected type: Widget ()
Actual type: hamlet-0.8.1:Text.Hamlet.Quasi.Hamlet url0
In the return type of a call of `pageBody'
In the first argument of
Which doesn't occur when I'm not trying to render "mainMenu" widget.
What am I doing wrong? And are there any informations about using widgets
( because I haven't found many.. )?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the web-devel