Derek,

Your new Menu snippet works great. I created a superfish-style menu
using
a list of groups, like so:

object MenuWidgetEx {

   def apply(groups:List[String]) = new MenuWidgetEx(groups,
MenuStyle.HORIZONTAL, JsObj()) render

   def apply(groups:List[String], style: MenuStyle.Value) = new
MenuWidgetEx(groups, style, JsObj()) render

   def apply(groups:List[String], jsObj: JsObj) = new MenuWidgetEx
(groups, MenuStyle.HORIZONTAL, jsObj) render

   def apply(groups:List[String], style: MenuStyle.Value, jsObj:
JsObj) = new MenuWidgetEx(groups, style, jsObj) render
}


class MenuWidgetEx(groups:List[String], style: MenuStyle.Value, jsObj:
JsObj) extends
  MenuWidget(LiftRules.siteMap open_!, style: MenuStyle.Value, jsObj:
JsObj){

     override def render :NodeSeq = {

        def buildMenu(group:String) = <lift:Menu.builder group={group}
expandAll="true" top:class={style.toString} />


        head ++ <div>
                {for(group <- groups) yield {buildMenu(group)}}
                </div>


   }

Someone should redo the MenuWidget snippet to handle your
new Menu.builder construct, so it doesn't have to be subclassed.

Glenn...



On Jun 12, 4:59 am, glenn <[email protected]> wrote:
> My error. Ignore this. I did a mvn clean then mvn install outside
> of Eclipse on the parent pom and everything worked fine.
>
> Glenn...
>
> On Jun 12, 4:45 am, glenn <[email protected]> wrote:
>
> > Derek,
>
> > I'd love to test the changes you made to Menu, but my build fails when
> > I run
> > mvn install on the pom in the lift directory of the download from
>
> >http://github.com/dpp/liftweb/tree/wip-dcb-menu-addons
>
> > Here's what maven reports:
>
> > [WARNING] Warning in manifest for net.liftweb:lift-webkit:jar:1.1-
> > SNAPSHOT : Did not find matching r
> > eferal for org.slf4j.*
> > [ERROR] Error in manifest for net.liftweb:lift-webkit:jar:1.1-
> > SNAPSHOT : The default package '.' is
> > not permitted by the Import-Package syntax.
> >  This can be caused by compile errors in Eclipse because Eclipse
> > creates
> > valid class files regardless of compile errors.
> > The following package(s) import from the default package
> > [net.liftweb.http, net.liftweb.http.auth, n
> > et.liftweb.http.js, net.liftweb.http.js.jquery, net.liftweb.sitemap]
> > [ERROR] Error(s) found in manifest configuration
> > [INFO]
> > ------------------------------------------------------------------------
> > [ERROR] BUILD ERROR
> > [INFO]
> > ------------------------------------------------------------------------
> > [INFO] Error(s) found in manifest configuration
>
> > It seems like a problem with the construction of the following
> > plugin in the pom.
>
> > <plugin>
> >         <groupId>org.apache.felix</groupId>
> >         <artifactId>maven-bundle-plugin</artifactId>
> >         <configuration>
> >           <instructions>
> >             <Export-Package>!
> > net.liftweb.util.*,net.liftweb.*;version="${pom.version}"</Export-
> > Package>
> >             <Import-Package>org.slf4j.*;resolution:="optional",*</
> > Import-Package>
> >             <DynamicImport-Package>*</DynamicImport-Package>
> >           </instructions>
> >         </configuration>
> >       </plugin>
>
> > Either that, or there's something else going on. Any ideas?
>
> > Glenn...
>
> > On Jun 11, 11:54 am, Derek Chen-Becker <[email protected]> wrote:
>
> > > I'm building some code right now that I think should handle all of your
> > > cases. Since Menu.builder is already concerned with building a menu tree, 
> > > I
> > > decided that it would be better to allow you to specify a specific item or
> > > group to Menu.builder instead of conflating tree building with the current
> > > Menu.item and Menu.group snippets. Given a SiteMap like:
>
> > >     val menus =
> > >       Menu(Loc("Home", List("index"), "Home Page")) ::
> > >       Menu(Loc("Viewtest", List("ViewTest", "test"), "View test")) ::
> > >       Menu(Loc("InsecureViewtest", List("Insecure", "test"), "Insecure 
> > > View
> > > test")) ::
> > >       Menu(Loc("SelectTest", List("select"), "asm select test")) ::
> > >       Menu(Loc("Help", List("help", "index"), "Help", LocGroup("help")),
> > >        Menu(Loc("About", List("help", "about"), "About", 
> > > LocGroup("help"))),
> > >        Menu(Loc("Version", List("help", "version"), "Version",
> > > LocGroup("help")))) :: Nil
>
> > > You can render just the Help tree with:
>
> > > <lift:Menu.builder item="Help" expandAll="true" />
>
> > > Which will render something like:
>
> > > <ul><li><a href="/testthis/help/
> > > <view-source:http://localhost:9090/testthis/help/>">Help</a><ul><li><a
> > > href="/testthis/help/about
> > > <view-source:http://localhost:9090/testthis/help/about>">About</a></li><li><a
> > > href="/testthis/help/version
> > > <view-source:http://localhost:9090/testthis/help/version>">Version</a></li></ul></li></ul>
>
> > > Similarly, you can use a group attribute:
>
> > > <lift:Menu.builder group="help" expandAll="true" />
>
> > > But notice that this won't deduplicate entries, so we would render 
> > > something
> > > like:
>
> > > <ul><li><a href="/testthis/help/
> > > <view-source:http://localhost:9090/testthis/help/>">Help</a><ul><li><a
> > > href="/testthis/help/about
> > > <view-source:http://localhost:9090/testthis/help/about>">About</a></li><li><a
> > > href="/testthis/help/version
> > > <view-source:http://localhost:9090/testthis/help/version>">Version</a></li></ul></li><li><a
> > > href="/testthis/help/about
> > > <view-source:http://localhost:9090/testthis/help/about>">About</a></li><li><a
> > > href="/testthis/help/version
> > > <view-source:http://localhost:9090/testthis/help/version>">Version</a></li></ul>
>
> > > This is currently checked in on the wip-dcb-menu-addons branch:
>
> > >http://github.com/dpp/liftweb/tree/wip-dcb-menu-addons
>
> > > Thoughts?
>
> > > Derek
>
> > > On Mon, Jun 8, 2009 at 5:49 PM, glenn <[email protected]> wrote:
>
> > > > Yes,
>
> > > > I would like the expandAll behavior to work for groups and for non-
> > > > root siteMaps.
> > > > Here's a specific use-case. The MenuWidget in the lift-widgets package
> > > > just passes everything
> > > > through  as
>
> > > > def render : NodeSeq = {
> > > >    head ++ <lift:Menu.builder expandAll="true" top:class=
> > > > {style.toString} />
> > > >  }
>
> > > > So, even though the MenuWidget object has factory methods
> > > > for using a  non-root siteMap, only the root siteMap is ever used.
> > > > That's
> > > > because Menu.builder calls a private function renderWhat, like so:
>
> > > > val toRender = renderWhat(expandAll)
>
> > > > which iterates through the root siteMap. There is no way, really, to
> > > > subclass that
> > > > to use a different siteMap.
>
> > > > The problem with the Menu.group snippet is that it just works off the
> > > > named group in
> > > > the root siteMap, creating a parent node, but not the kids.
>
> > > > It would be nice to use MenuWidget, or some subclass, to create a
> > > > superfish-style
> > > > nav-bar or horizontal menu for groups or non-root siteMaps just as
> > > > easily as for the
> > > > entire root siteMap.
>
> > > > Glenn...
>
> > > > On Jun 8, 3:51 pm, Joe Wass <[email protected]> wrote:
> > > > > What I really wanted was a menu group. Doing things in groups has
> > > > > solved my particular question.
>
> > > > > Glenn, can you not just use groups? Do you need the hierarchal
> > > > > behaviour of nested menus?
>
> > > > > Joe
>
> > > > > On Jun 8, 10:24 pm, glenn <[email protected]> wrote:
>
> > > > > > I have a similar request: namely, being able to apply 
> > > > > > expandAll="true"
> > > > > > attribute
> > > > > > not just to <lift:Menu.builder.../>
>
> > > > > > but to <lift:Menu.group name="mygroup"/> and <lift:Menu.item
> > > > > > name="myMenu"/>, or, as Joe requests below,
>
> > > > > > to any siteMap that is not the root siteMap.
>
> > > > > > Glenn...
>
> > > > > > On Jun 8, 2:06 pm, Joe Wass <[email protected]> wrote:
>
> > > > > > > Sorry for yet another menu question. I have scoured this list 
> > > > > > > first,
> > > > I
> > > > > > > promise!
>
> > > > > > > I'm trying to do something I think is quite simple:
>
> > > > > > > Two [or any nuumber of] menus (with children). Two different
> > > > > > > templates. One menu and children shows up on one template, one 
> > > > > > > shows
> > > > > > > up on another. They are each nested menus (i.e. I have two Menus,
> > > > each
> > > > > > > with child menu items). You can directly go to any page you want, 
> > > > > > > but
> > > > > > > only certain Menu items show up on certain templates.
>
> > > > > > > I had thought I could put a guard (the last argument of the Loc) 
> > > > > > > to
> > > > > > > only show a menu when the request string contains part of the 
> > > > > > > path,
> > > > > > > but of course, that prevents you from navigating there in the 
> > > > > > > first
> > > > > > > place so that's out.
>
> > > > > > > I've seen this post :
> > > >http://groups.google.com/group/liftweb/browse_thread/thread/dbdf6a17b...
>
> > > > > > > but it doesn't quite do what I want: I want to be able to show a
> > > > whole
> > > > > > > Menu at a time, not have to list each individual item in the
> > > > template.
> > > > > > > I'd like to do something like this:
>
> > > > > > > <lift:Menu.builder menuName="menu_name"/>
>
> > > > > > > Any ideas? I'll accept a hack, I'm short on time!
>
> > > > > > > Bonus marks: how do you set a menu to be expanded by default 
> > > > > > > (without
> > > > > > > having to be on the root node's page)? I saw `expandAll="true"`
> > > > > > > somewhere, but that doesn't do anything...
>
> > > > > > > Thanks!
>
> > > > > > > Joe

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to