net.liftweb.builtin.snippet

Menu

object Menu extends DispatchSnippet

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

Linear Supertypes
DispatchSnippet, AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Menu
  2. DispatchSnippet
  3. AnyRef
  4. Any
Visibility
  1. Public
  2. All

Type Members

  1. type DispatchIt = PartialFunction[String, (NodeSeq) ⇒ NodeSeq]

    Definition Classes
    DispatchSnippet

Value Members

  1. final def !=(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

    Definition Classes
    AnyRef → Any
  4. final def ==(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  5. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  6. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  7. def builder(info: NodeSeq): NodeSeq

    This snippet method renders a menu representing your SiteMap contents.

    This snippet method renders a menu representing your SiteMap contents. 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
    • level - Controls the level of menus that will be output. "0" is the top-level menu, "1" is children of the current menu item, and so on. Child menus will be expanded unless the "expand" attribute is set to
      false
      
      .
    • expand - Controls whether or not to expand child menus. Defaults to
      true
      
      .

    If you are using designer friendly invocation, you can access the namespaced attributes:
    <div class="lift:Menu?li_item:class=foo+bar">menu</div>

    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;" />
    

  8. def clone(): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  9. def dispatch: DispatchIt

    Definition Classes
    MenuDispatchSnippet
  10. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  11. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  12. def finalize(): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  13. final def getClass(): java.lang.Class[_]

    Definition Classes
    AnyRef → Any
  14. def group(template: NodeSeq): NodeSeq

    Renders a group of menu items.

    Renders a group of menu items. 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 (&lta />), 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>
    

  15. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  16. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  17. def item(text: NodeSeq): NodeSeq

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

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

    val menus =
      Menu(Loc("a",...,...,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 (&lta />). 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;" />
    

    The param attribute may be used with Menu Locs that are CovertableLoc to parameterize the link

    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)

    Alternatively, you can set the "linkToSelf" attribute to "true" to force a link. You can specify your own link text with the tag's contents. Note that case is significant, so make sure you specify "linkToSelf" and not "linktoself".

  18. def jsonMenu(ignore: NodeSeq): NodeSeq

  19. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  20. final def notify(): Unit

    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  22. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  23. def title(text: NodeSeq): NodeSeq

    Renders the title for the current request path (location).

    Renders the title for the current request path (location). You can use this to automatically set the title for your page based on your SiteMap:

    ⋮
    <head>
      <title><lift:Menu.title /></title>
    </head>
    ⋮
    

    HTML5 does not support tags inside the <title> tag, so you must do:

    <head>
      <title class="lift:Menu.title"e;>The page named %*% is being displayed</title>
    </head>
    

    And Lift will substitute the title at the %*% marker if the marker exists, otherwise append the title to the contents of the <title> tag.

  24. def toString(): String

    Definition Classes
    AnyRef → Any
  25. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  26. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()
  27. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from DispatchSnippet

Inherited from AnyRef

Inherited from Any