New SiteMap/Menu features

24 views
Skip to first unread message

David Pollak

unread,
Aug 16, 2008, 1:48:29 PM8/16/08
to liftweb
Folks,

I've made a bunch of updates to SiteMap and Lift's built-in snippets.

When you define a Menu Location (Loc()), you specify a "name" as the first parameter.  That name now has a use.

You can now insert a menu item on a page with <lift:Menu.item name="item_name"/>  If the menu item can be displayed, an <a href="...">text</a> will be generated, otherwise a blank will be returned.  That way you can do <lift:Menu.item name="Login"/><lift:Menu.item name="Logout" /> next to each other and only the Log In or Log Out link will be displayed.

But wait... there's more... <lift:Menu.item name="foo"><b>Very Foo</b></lift:Menu.item> will put "<b>Very Foo</b> in the link rather than the default link text.

But wait... there's more... <lift:Menu.item name="foo" a:class="my_class" a:onclick="javascript:"/> will put "class" and "onclick" attributes on the generated <a /> tag.

But wait... there's more... <lift:Menu.builder ul:class="class_for_ul_tag" li:class="class_for_li_tags" li_item:class="class_for_current_page" li_path:class="class_for_breadcrumb_path"/>

Note that the suffixes for any given prefix (a, ul, li, li_item, etc.) can be anything and unprefixed attributes are created for these items.

Thanks,

David

--
Lift, the simply functional web framework http://liftweb.net
Collaborative Task Management http://much4.us
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Marius

unread,
Aug 16, 2008, 4:08:16 PM8/16/08
to liftweb
Very nice stuff David !

On Aug 16, 8:48 pm, "David Pollak" <feeder.of.the.be...@gmail.com>
wrote:
> Collaborative Task Managementhttp://much4.us

Viktor Klang

unread,
Aug 17, 2008, 7:23:28 AM8/17/08
to lif...@googlegroups.com
Slick!
--
Viktor Klang
Rogue Software Architect

TylerWeir

unread,
Aug 17, 2008, 10:41:57 AM8/17/08
to liftweb
> > But wait... there's more... <lift:Menu.builder ul:class="class_for_ul_tag"
> > li:class="class_for_li_tags" li_item:class="class_for_current_page"
> > li_path:class="class_for_breadcrumb_path"/>

Perfect, thanks Dave!


On Aug 17, 7:23 am, "Viktor Klang" <viktor.kl...@gmail.com> wrote:
> Slick!
>
> On Sat, Aug 16, 2008 at 7:48 PM, David Pollak <feeder.of.the.be...@gmail.com
> > Lift, the simply functional web frameworkhttp://liftweb.net
> > Collaborative Task Managementhttp://much4.us

Tim Perrett

unread,
Sep 7, 2008, 10:54:20 AM9/7/08
to Lift
Wow, how did this slip by without me noticing before! Awesome work,
cheers Dave!!

David Pollak

unread,
Sep 7, 2008, 11:21:54 AM9/7/08
to lif...@googlegroups.com


Tim Perrett wrote:
Wow, how did this slip by without me noticing before! 
I was hiding it from you... :-)
Reply all
Reply to author
Forward
0 new messages