net.liftweb.builtin.snippet.Menu

object Menu

object Menu

 extends DispatchSnippet with ScalaObject


This built-in snippet can be used to render a menu representing your SiteMap. There are three main snippet methods that you can use:

More detailed usage of each method is provided below



Source: Menu.scala(43)

 Constructors

def this

 Fields

dispatch.. def dispatch PartialFunction

 Methods

!=.. final def !=(arg0 : Object) Boolean AnyRef
!=.. final def !=(arg0 : Any) Boolean Any
==.. final def ==(arg0 : Any) Boolean Any
==.. final def ==(arg0 : Object) Boolean AnyRef
asInstanceOf.. final def asInstanceOf[T0] T0 Any
builder.. def builder(info : NodeSeq)

This snippet method renders a menu representing your SiteMap contents [details]

The menu is rendered as a set of nested unordered lists (<ul />). By default, it only renders nested child menus for menus that match the current request path. You can add the "expandAll" attribute to the snippet tag to force full expansion of all child menus. Additionally, you can use the following attribute prefixes to further customize the generated list and list item elements:

  • top - Adds the specified attribute to the top-level <ul> element that makes up the menu
  • ul - Adds the specified attribute to each <ul> element (top-level and nested children) that makes up the menu
  • li - Adds the specified attribute to each <li> element for the menu
  • li_item - Adds the specified attribute to the current pageÕs menu item
  • outer_tag - the tag for the outer XML element (ul by default)
  • inner_tag - the tag for the inner XML element (li by default)
  • li_path - Adds the specified attribute to the current pageÕs breadcrumb path. The breadcrumb path is the set of menu items leading to this one.
  • linkToSelf - false by default, but available as 'true' to generate link to the current page

For a simple, default menu, simply add

     <lift:Menu.builder />
   

To your template. You can render the entire sitemap with

      <lift:Menu.builder expandAll="true" />
   

Customizing the elements is handled through the prefixed attributes described above. For instance, you could make the current page menu item red:

      <lift:Menu.builder li_item:style="color: red;" />
   
NodeSeq
clone.. protected def clone Object AnyRef
eq.. final def eq(arg0 : Object) Boolean AnyRef
equals.. def equals(arg0 : Any) Boolean AnyRef
finalize.. protected def finalize Unit AnyRef
getClass.. final def getClass Class[Any] AnyRef
group.. def group(template : NodeSeq)

Renders a group of menu items [details]

You specify a group using the LocGroup LocItem case class on your Menu Loc:

   val menus =
     Menu(Loc("a",...,...,LocGroup("test"))) ::
     Menu(Loc("b",...,...,LocGroup("test"))) ::
     Menu(Loc("c",...,...,LocGroup("test"))) :: Nil
   

You can then render with the group snippet:

   <lift:Menu.group group="test" />
   

Each menu item is rendered as an anchor tag (<a />), and you can customize the tag using attributes prefixed with "a":

   <lift:Menu.group group="test" a:class="menulink" />
   

You can also specify your own template within the Menu.group snippet tag, as long as you provide a <menu:bind /> element where the snippet can place each menu item:

   <ul>
   <lift:Menu.group group="test" >
     <li><menu:bind /></li>
   </lift:Menu.group>
   
NodeSeq
hashCode.. def hashCode Int AnyRef
isInstanceOf.. final def isInstanceOf[T0] Boolean Any
item.. def item(text : NodeSeq)

Renders a specific, named item, based on the name given in the Menu's Loc paramter:

   val menus =
     Menu(Loc("a",
        
              [details]
              
..,...,LocGroup("test"))) :: Menu(Loc("b",...,...,LocGroup("test"))) :: Menu(Loc("c",...,...,LocGroup("test"))) :: Nil

You can then select the item using the name attribute:

   <lift:Menu.item name="b" />
   

The menu item is rendered as an anchor tag (<a />). The text for the link defaults to the named Menu's Loc.linkText, but you can specify your own link text by providing contents to the tag:

   <lift:Menu.item name="b">This is a link</lift:Menu.item>
   

Additionally you can customize the tag using attributes prefixed with "a":

   <lift:Menu.item name="b" a:style="color: red;" />
   

Normally, the Menu item is not shown on pages that match its Menu's Loc. You can set the "donthide" attribute on the tag to force it to show text only (same text as normal, but not in an anchor tag)

NodeSeq
jsonMenu.. def jsonMenu(ignore : NodeSeq) NodeSeq
ne.. final def ne(arg0 : Object) Boolean AnyRef
notify.. final def notify Unit AnyRef
notifyAll.. final def notifyAll Unit AnyRef
synchronized.. final def synchronized[T0](arg0 : T0) T0 AnyRef
title.. def title(text : NodeSeq)

Renders the title for the current request path (location) [details]

You can use this to automatically set the title for your page based on your SiteMap:

   ...
   <head>
     <title><lift:Menu.title /></title>
   </head>
   ...
   
NodeSeq
toString.. def toString String AnyRef
wait.. final def wait(arg0 : Long, arg1 : Int) Unit AnyRef
wait.. final def wait Unit AnyRef
wait.. final def wait(arg0 : Long) Unit AnyRef
Copyright (c) 2006-2010 WorldWide Conferencing, LLC. All Rights Reserved.