src/main/scala/bootstrap/liftweb/Boot.scala
changeset 22 6b1a7f3429ca
parent 2 cf829ec742b3
--- a/src/main/scala/bootstrap/liftweb/Boot.scala	Thu Apr 14 15:42:46 2011 +0200
+++ b/src/main/scala/bootstrap/liftweb/Boot.scala	Wed Nov 30 16:59:10 2011 +0100
@@ -17,11 +17,14 @@
 
 import net.liftweb.common._
 import net.liftweb.http._
+import net.liftweb.http.js.JsObj
+import net.liftweb.http.js.JE.JsObj
 import net.liftweb.mapper._
 import net.liftweb.sitemap._
 import net.liftweb.sitemap.Loc._
+import net.liftweb.widgets.menu.MenuStyle
+import net.liftweb.widgets.menu.{MenuWidget => LiftMenuWidget}
 import net.liftweb.util._
-import net.liftweb.widgets.menu.MenuWidget
 import net.tz.lift.snippet.ActionLinks
 import net.tz.lift.util.YmdDateTimeConverter
 import radview.model._
@@ -57,7 +60,9 @@
     LiftRules.snippetDispatch.append {
       case "Menubar" => new AnyRef with DispatchSnippet {
         def dispatch: DispatchIt = {
-          case _ => { xhtml => MenuWidget() }
+          case _ => { xhtml =>
+            new MenuWidget(MenuStyle.HORIZONTAL, JsObj(), Nil) render
+          }
         }
       }
       case "action-links" => ActionLinks
@@ -72,11 +77,12 @@
       Menu.i("Cells") / "cell",
       Menu(SessionSnippet),
       Menu(AccountSnippet),
-      Menu.i("Accounts") / "account"
+      Menu.i("Accounts") / "account",
+      DynIpSnippet.menu
     ))
 
     /* Menu widget */
-    MenuWidget.init()
+    LiftMenuWidget.init()
 
     /* Http conf */
     LiftRules.logServiceRequestTiming = false
@@ -94,4 +100,18 @@
   }
 }
 
+class MenuWidget(style: MenuStyle.Value, jsObj: JsObj, groups : List[String])
+  extends LiftMenuWidget(style, jsObj, groups) {
+
+  override def render: NodeSeq = { 
+    head ++ <div>{groups match {
+      case Nil =>
+        <lift:Menu.builder expandAll="true" linkToSelf="true" top:class={style.toString} />
+      case xs => groups.flatMap(group =>
+        <lift:Menu.builder expandAll="true" linkToSelf="true" top:class={style.toString} group={group} />)
+    }}</div>
+  }
+}
+
+
 // vim: set ts=2 sw=2 et: