Hi Nolan, I had the same requirements. What I ended up doing is something along these lines:
// // For the brand maintenance, we'll use the standard CRUDify stuff from the Brand model. // The menus created by CRUDify will be plucked apart. The view menu will be the main brand menu // while the create menu will become a submenu off of that. // val brandMenu = Menu(Brand.menus.first.loc, Brand.menus.drop(1):_*) // // For the SKU maintenance, we'll use the standard CRUDify stuff from the Sku model. // The menus created by CRUDify will be plucked apart. The view menu will be the main Sku menu // while the create menu will become a submenu off of that. // val skuMenu = Menu(Sku.menus.first.loc, Sku.menus.drop(1):_*) (I have a slew of these kinds of things) So I basically build a new menu for the first item (Brand.menus.first.loc) for each set of menus, make that the menu that shows up by default, and then make the remaining two (Brand.menus.drop(1):_*) submenus. (Note the ":_*". That's Scala magic for saying to interpret this list as varargs to a function.) Then I simply put all the *Menu vals in a list and pass it to the sitemap: val entries:List[Menu] = List(Menu(Loc("Home", List("index"), "Home")), brandMenu, skuMenu) ) LiftRules.setSiteMap(SiteMap(entries:_*)) (I have shortened the list of menus... Also note that I've adopted a much more explicit way of building these menus. What I found is that I can write it the way the examples show, but I have a hard time interpreting it again after a day or two. I find documenting this stuff much easier if it is all broken up instead of everything in one statement. I'm sure as I get better at Scala this will change.) To make the menus look nicer, I overload the label in each model. As an example, here's my Brand model: import net.liftweb.mapper._ import net.liftweb.util._ class Brand extends LongKeyedMapper[Brand] with IdPK { def getSingleton = Brand object name extends MappedString(this, 200) { override def displayName = "Brand code" } object company extends MappedString(this, 100) { override def displayName = "Company name" } object product extends MappedString(this, 100) { override def displayName = "Product name" } object certificateTemplate extends MappedString(this, 200) { override def displayName = "Resource path to certificate template" } object serialNumberPrefix extends MappedString(this, 4) { override def displayName = "Serial number prefix (4 uppercase letters)" } } object Brand extends Brand with LongKeyedMetaMapper[Brand] with CRUDify[Long, Brand] { override def fieldOrder = List(name, company, product) def allBrands: List[Brand] = findAll override def showAllMenuName = "Maintain brands" } Hope that helps a bit. --Andrew Nolan Darilek wrote: > Cool, thanks again. Here's another. I'm looking through the Mastering > Lift book chapter on sitemaps, and if there's an answer then I don't see it. > > I have several CRUD objects that I'd like to put in their own submenus. > I can't seem to make this happen. If I stick exclusively to Model.menus, > it works, but if I do something like: > > val entries = > Menu(Loc("Home", List("index"), "Home")) :: > Menu(Loc("layouts", List("layout", "list"), "Layouts"), > Layout.menus:_*) :: > User.sitemap > > What I'm expecting to happen is that I'll get a Layouts menu linking to > /layout/list, a Loc created by Layout.menus. What actually *does* happen > is, apparently, a template lookup of layout/list on the filesystem. I > also tried passing Nil as the final argument to Loc, thinking it might > defer creation of a link to a template and let Layout.menus set that up, > but no luck. > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to liftweb+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~----------~----~----~----~------~----~------~--~---