Hi all,<br><br>I'm trying to add to my "admin layout" main menu in Yesod.<br><br>Normally - doing it in Rails - I would create a partial <br>or helper and then use it in my layout file.<br><br>But here in Yesod - the concept of widgets seems <br>
somewhat fereign to me. I don't quite get them.<br><br>In my Handler.Admin module I define:<br><br>adminLayout :: GWidget MyApp MyApp () -> GHandler MyApp MyApp RepHtml<br>adminLayout widget = do<br> mmsg <- getMessage<br>
mroute <- getCurrentRoute<br> pc <- widgetToPageContent $ do<br> widget<br> hamletToRepHtml $(hamletFile "admin/admin-layout")<br><br>then I define my widget ( all in the same file ):<br><br>
mainMenu :: Widget ()<br>mainMenu =<br> addWidget $(widgetFile "admin/_menu")<br><br>And finally in "admin/admin-layout.hamlet" I'm trying to render my menu:<br><br>...<br>^{mainMenu}<br>...<br><br>
All without a luck.. Compiler yells at me strange ( to me ) things:<br><br>Handler/Admin.hs:31:27:<br> Couldn't match expected type `GGWidget<br> MyApp (GHandler MyApp MyApp) ()'<br>
with actual type `(url0 -> [(T.Text, T.Text)] -> T.Text)<br> -> blaze-html-0.4.1.1:Text.Blaze.Internal.Html'<br> Expected type: Widget ()<br> Actual type: hamlet-0.8.1:Text.Hamlet.Quasi.Hamlet url0<br>
In the return type of a call of `pageBody'<br> In the first argument of `hamlet-0.8.1:Text.Hamlet.Quasi.fromHamletValue', namely<br> `pageBody pc'<br><br>Which doesn't occur when I'm not trying to render "mainMenu" widget.<br>
<br>What am I doing wrong? And are there any informations about using widgets anywhere? <br>( because I haven't found many.. )?<br><br>Best regards<br>Kamil Ciemniewski<br><br>