annotate examples/popup.ur @ 6:f17b869fbb71

Shifting some generic theme navigation menu code to the library.
author Karn Kallio <kkallio@eka>
date Tue, 26 Apr 2011 20:27:04 -0430
parents
children 48a4180171b0
rev   line source
kkallio@6 1 open Navbar
kkallio@6 2 open PopupNav
kkallio@6 3
kkallio@6 4 val testNav = navAdd (mkNavItem "item 2" (bless "http://item2.org"))
kkallio@6 5 (navAdd (mkNavItem "item 1" (bless "http://item1.org"))
kkallio@6 6 emptyNavBar)
kkallio@6 7
kkallio@6 8 val testNav' = navAdd (mkNavItem "item 3" (bless "http://item3.org"))
kkallio@6 9 testNav
kkallio@6 10
kkallio@6 11 val otherFormat = {FormatMenu = fn ctl menu => <xml><h3>A Custom {ctl} Format</h3><ul>{menu}</ul></xml>,
kkallio@6 12 OpenCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>View</a></xml>,
kkallio@6 13 CloseCtl = fn behaviour => <xml><a href={bless "http://#"} onclick={behaviour}>Hide</a></xml>}
kkallio@6 14
kkallio@6 15
kkallio@6 16 fun main () =
kkallio@6 17
kkallio@6 18 defaultFormatPopUp <- create defaultFormat testNav';
kkallio@6 19 otherFormatPopUp <- create otherFormat testNav';
kkallio@6 20
kkallio@6 21 return <xml>
kkallio@6 22 <head>
kkallio@6 23 <title>Navbar Based Popup Navigation.</title>
kkallio@6 24 </head>
kkallio@6 25 <body>
kkallio@6 26 <h1>Example of using Navbar to build a widget.</h1>
kkallio@6 27 <p>
kkallio@6 28 This is a widget which generates a popup list
kkallio@6 29 of links.
kkallio@6 30 </p>
kkallio@6 31 <h2>Example of the default format.</h2>
kkallio@6 32 <p>
kkallio@6 33 {render defaultFormatPopUp}
kkallio@6 34 </p>
kkallio@6 35 <h2>Example of another format.</h2>
kkallio@6 36 <p>
kkallio@6 37 {render otherFormatPopUp}
kkallio@6 38 </p>
kkallio@6 39 </body>
kkallio@6 40 </xml>