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:
- builder - Renders the entire SiteMap, optionally expanding all child menus
- group - Renders the MenuItems corresponding to the specified group.
- item - Renders the specific named MenuItem
More detailed usage of each method is provided below
- Alphabetic
- By Inheritance
- Menu
- DispatchSnippet
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Type Members
-
type
DispatchIt = PartialFunction[String, (NodeSeq) ⇒ NodeSeq]
- Definition Classes
- DispatchSnippet
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
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;" />
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;" />
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
def
dispatch: DispatchIt
- Definition Classes
- Menu → DispatchSnippet
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
group: CssSel
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 overli
elements. You can customize these settings using therepeatedSelector
,linkSelector
, andhrefSelector
parameters; for example: .Bound menu item
These selectors are CSS selector transform selectors.
repeatedSelector
andlinkSelector
are the left-hand-side, whilehrefSelector
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> & }
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
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 (<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;" />
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".
- def jsonMenu(ignore: NodeSeq): NodeSeq
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
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.
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )