view examples/navtest.ur @ 16:2e397d373289

Add RemotePager.
author Karn Kallio <kkallio@eka>
date Thu, 18 Aug 2011 12:53:17 -0430
parents 48a4180171b0
children
line wrap: on
line source
open Navbar
open Navigation

val bar = navAdd (mkNavItem "Item 2" (bless "http://item2.com")) (navAdd (mkNavItem "Item 1" (bless "http://item1.org")) emptyNavBar)

val link = mkNavItem "Special link" (bless "http://special.net")

structure N = Make(struct
                       con navbarPos = [Main]
                       con msgPos = [Top]

                       con themePos = [Main]

                       val linkStyles = {Special = None}

                       fun formatNav barPieces lnkPieces msgPieces =
                           {Main = <xml>{msgPieces.Top}<h3>Here is a menu.</h3><ul>{barPieces.Main}<li>{lnkPieces.Special}</li></ul></xml>}
                   end)

open N

val topMsg : xbody = <xml><div>A banner message</div></xml>

val nav = mkNav {Main = bar} {Special = Some link} {Top = Some topMsg}

val xml = toXml nav


fun main () =
    return <xml>
      <head>
        <title>Navbar Based Navigation.</title>
      </head>
      <body>
        <h1>Example of using a Navigation.</h1>
        <p>
          This is a theme widget which manages a set
          of links, messages and menus for site navigation.
        </p>
        <h2>Example of a navigation turned into a piece of xml.</h2>
        <div>
          {xml.Main}
        </div>
      </body>
    </xml>