Object

net.liftweb.builtin.snippet

Menu

Related Doc: package snippet

Permalink

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
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Menu
  2. DispatchSnippet
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Visibility
  1. Public
  2. All

Type Members

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

    Permalink
    Definition Classes
    DispatchSnippet

Value Members

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

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

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

    Permalink
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  5. def builder(info: NodeSeq): NodeSeq

    Permalink

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

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

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

  6. def clone(): AnyRef

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

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

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

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

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

    Permalink
    Definition Classes
    AnyRef → Any
  12. def group: CssSel

    Permalink

    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:

    <nav data-lift="Menu.group?group=test">
    
    
     -
          <a href="/sample/link">Bound menu item</a>
    
    
    </nav>

    By default, menu items bind the href and text of an a element in the template, and iterates over li elements. You can customize these settings using the repeatedSelector, linkSelector, and hrefSelector parameters; for example: .

    Bound menu item

    These selectors are CSS selector transform selectors. repeatedSelector and linkSelector are the left-hand-side, while hrefSelector is the second part, which indicates what will be replaced by the href text. For example, the above would roughly yield a transform that looks like:

    "p" #> {
      "p [data-link]" #> <menu href> &
      "p *" #> <menu text> &
    }
  13. def hashCode(): Int

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

    Permalink
    Definition Classes
    Any
  15. def item(_text: NodeSeq): NodeSeq

    Permalink

    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".

  16. def jsonMenu(ignore: NodeSeq): NodeSeq

    Permalink
  17. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  18. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  19. final def notifyAll(): Unit

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

    Permalink
    Definition Classes
    AnyRef
  21. def title(text: NodeSeq): NodeSeq

    Permalink

    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.

  22. def toString(): String

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

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

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

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from DispatchSnippet

Inherited from AnyRef

Inherited from Any

Ungrouped