[Lift] Re: Tabs + menu builder
tiro tim.romb...@googlemail.com writes: Jeppe We've made primary/secondary navigation where primary navigation is ... I did something similar..found it difficult to work with the default snippets. But found it hard, when writing my own group snippet, to identify the current Loc within the LocGroups Locs. It's been a while since I wrote this, so don't recall if there any issues, but this is my group snippet: def group(template:NodeSeq) : NodeSeq = { val toBind = if ((template \ bind).filter(_.prefix == menu).isEmpty) xml:groupmenu:bind/ /xml:group else template val attrs = S.prefixedAttrsToMetaData(a) for (group - S.attr(group).toList; siteMap - LiftRules.siteMap.toList; loc - siteMap.locForGroup(group); req - S.request; curLoc - req.location; link - loc.createDefaultLink; linkText - loc.linkText) yield { val a = (if (inPath(loc, curLoc.breadCrumbs)) span{linkText}/span else a href={link}{linkText}/a) % attrs Group(bind(menu, toBind, bind - a)) } } So Jeppe, would be very interested in your code for that snippet. Mine is below (only slightly modified from Menu.group). But it's not yet quite there. I also used Menu.group as a starting point. I also had a fiendish problem (lift 1.0.2 scala 2.7.5) when trying to use attributes li:class=x li_item:class=y on the tag. Isn't that a standard technique? Does it work for everyone else? For me, Scala chokes on that with a syntax error (further experiments suggest that it doesn't like two attributes with same name and different prefix, perhaps also because BOTH prefixes are from an unknown namespace). Of course it doesn't show you the exact error but faults with an IllegalArgumentException on scala.io.Source, but this has been discussed elsewhere. Anyway, that's why I have the new unprefixed attributes in the code below. Actually, I think I reported this as well and this works now (at least in 1.1-SNAPSHOT). If possible, you should upgrade to 1.1 since the error reporting has improved a lot. The IllegalArgumentException error you see is not the root cause in your code, but an error that happens when trying to show the source of the error ! /Jeppe --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Tabs + menu builder
Jeppe We've made primary/secondary navigation where primary navigation is ... I did something similar..found it difficult to work with the default snippets. But found it hard, when writing my own group snippet, to identify the current Loc within the LocGroups Locs. So Jeppe, would be very interested in your code for that snippet. Mine is below (only slightly modified from Menu.group). But it's not yet quite there. I also had a fiendish problem (lift 1.0.2 scala 2.7.5) when trying to use attributes li:class=x li_item:class=y on the tag. Isn't that a standard technique? Does it work for everyone else? For me, Scala chokes on that with a syntax error (further experiments suggest that it doesn't like two attributes with same name and different prefix, perhaps also because BOTH prefixes are from an unknown namespace). Of course it doesn't show you the exact error but faults with an IllegalArgumentException on scala.io.Source, but this has been discussed elsewhere. Anyway, that's why I have the new unprefixed attributes in the code below. def menuGroup(template: NodeSeq): NodeSeq = { val a_attrs = S.prefixedAttrsToMetaData(a) val li_attrs = S.attr(normalclass) match { case Full(c: String) = new UnprefixedAttribute(class, c, Null); case _ = Null } val li_sel_attrs = S.attr(selectedclass) match { case Full(c: String) = new UnprefixedAttribute(class, c, Null); case _ = Null } val currentLoc = LiftRules.siteMap.open_!.findLoc (S.request.open_!) openOr null for (group - S.attr(group).toList; siteMap - LiftRules.siteMap.toList; loc - siteMap.locForGroup(group); link - loc.createDefaultLink; linkText - loc.linkText) yield { val a = a href={link}{linkText}/a % a_attrs var li: Elem = li{a}/li if (loc == currentLoc) li % li_sel_attrs else li % li_attrs } } --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Tabs + menu builder
caw1461 caw1...@gmail.com writes: I'm working on a UI for a project and we are looking at the jquery tabs. Currently we just have a plain menu builder site map. we are thinking that a good way to create our UI is to somehow link the site builder with the Tabs such that each tab holds a different link from the site map. I know this is slightly vague, but any advice for a new to lift and scala and HTML/XML. We've made primary/secondary navigation where primary navigation is a list across the screen (could be tabs in your case), and the secondary navigation is dynamic based on the selected primary navigation item. Everything is defined in the sitemap, with some custom menu snippets. We're using LocGroup's to indicate whether an item is primary or secondary (or something else :-) and created a snippet to render a group: lift:FZMenu.group group=primarylimenu:bind //li/lift:FZMenu.group The secondary navigation has it's own snippet (it's collapsable): lift:FZMenu.secondary group=secondary li_item:class=selected / /Jeppe --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Tabs + menu builder
It would be pretty easy to write your own snippet and get inspired from Lift's menu snippet code.THe Menu snippet produces lists (ul/li) and if your JQuery Tab plugin works with HTML lists it should work almost on the fly? Br's, Marius On Sep 17, 4:05 pm, caw1461 caw1...@gmail.com wrote: I'm working on a UI for a project and we are looking at the jquery tabs. Currently we just have a plain menu builder site map. we are thinking that a good way to create our UI is to somehow link the site builder with the Tabs such that each tab holds a different link from the site map. I know this is slightly vague, but any advice for a new to lift and scala and HTML/XML. Thanks in advance --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
[Lift] Re: Tabs + menu builder
You can use lift:Menu.json/ to create a JavaScript variable called lift_menu that contains all the menu items. You can then use client-side JavaScript to read the objects and construct whatever menu you want. On Thu, Sep 17, 2009 at 3:02 PM, marius d. marius.dan...@gmail.com wrote: It would be pretty easy to write your own snippet and get inspired from Lift's menu snippet code.THe Menu snippet produces lists (ul/li) and if your JQuery Tab plugin works with HTML lists it should work almost on the fly? Br's, Marius On Sep 17, 4:05 pm, caw1461 caw1...@gmail.com wrote: I'm working on a UI for a project and we are looking at the jquery tabs. Currently we just have a plain menu builder site map. we are thinking that a good way to create our UI is to somehow link the site builder with the Tabs such that each tab holds a different link from the site map. I know this is slightly vague, but any advice for a new to lift and scala and HTML/XML. Thanks in advance -- Lift, the simply functional web framework http://liftweb.net Beginning Scala http://www.apress.com/book/view/1430219890 Follow me: http://twitter.com/dpp Git some: http://github.com/dpp --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---