Question

I'm trying to implement this nav bar on my Yesod web app. My question how should I call a hamlet file from the javascript?

.....
.....
var Tabs = {
    'Tab one'   : 'pages/page1.html',
    'Tab two'   : 'pages/page2.html',
    'Tab three' : 'pages/page3.html',
    'Tab four'  : 'pages/page4.html'
}
.....
.....

As you can see it's calling the html pages with relative pathing, how do I do something like $(widgetFile "mypage")?or @{MyPageControllerR}?

Was it helpful?

Solution

I suggest to you write as html

<ul>
    <li>
      <a href="@{...}" ...

You can write as javascript using julius, in that case some like

var Tabs = {
    'Tab one'   : '@{MyPageController1R}',
    'Tab two'   : '@{MyPageController2R}',
    'Tab three' : '@{MyPageController3R}',
    'Tab four'  : '@{MyPageController4R}'
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top