[Lift] Re: bind with outer element?
Hi, I actually solved by wrapping the node i cared about in another node, but tried the FuncBindParam and it does seem to only grab the child nodes. On Aug 11, 11:37 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Doesn't the FuncBindParam only get the element's child NodeSeq? - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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 -~--~~~~--~~--~--~---
[Lift] Re: bind with outer element?
BindHelpers.currentNode is a Box[NodeSeq] that gives you the node that bind is currently replacing. -Ross On Aug 12, 2009, at 11:02 AM, jon wrote: Hi, I actually solved by wrapping the node i cared about in another node, but tried the FuncBindParam and it does seem to only grab the child nodes. On Aug 11, 11:37 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Doesn't the FuncBindParam only get the element's child NodeSeq? - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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 -~--~~~~--~~--~--~---
[Lift] Re: bind with outer element?
Thanks Ross! that works. On Aug 12, 1:59 pm, Ross Mellgren dri...@gmail.com wrote: BindHelpers.currentNode is a Box[NodeSeq] that gives you the node that bind is currently replacing. -Ross On Aug 12, 2009, at 11:02 AM, jon wrote: Hi, I actually solved by wrapping the node i cared about in another node, but tried the FuncBindParam and it does seem to only grab the child nodes. On Aug 11, 11:37 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Doesn't the FuncBindParam only get the element's child NodeSeq? - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://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 -~--~~~~--~~--~--~---
[Lift] Re: bind with outer element?
On Wed, Aug 12, 2009 at 11:31 AM, jon jonhoff...@gmail.com wrote: Thanks Ross! that works. +1 On Aug 12, 1:59 pm, Ross Mellgren dri...@gmail.com wrote: BindHelpers.currentNode is a Box[NodeSeq] that gives you the node that bind is currently replacing. -Ross On Aug 12, 2009, at 11:02 AM, jon wrote: Hi, I actually solved by wrapping the node i cared about in another node, but tried the FuncBindParam and it does seem to only grab the child nodes. On Aug 11, 11:37 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Doesn't the FuncBindParam only get the element's child NodeSeq? - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- Lift, the simply functional web frameworkhttp://liftweb.net Beginning Scalahttp://www.apress.com/book/view/1430219890 Follow me:http://twitter.com/dpp Git some:http://github.com/dpp -- 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 -~--~~~~--~~--~--~---
[Lift] Re: bind with outer element?
Jon, To read attributes, you do the following: S.attr(shorten) // = Box[String] Cheers, Tim On Aug 10, 9:44 pm, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon --~--~-~--~~~---~--~~ 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: bind with outer element?
If I'm not mistaken, S.attr is an attribute on the snippet xml node; for the node currently being processed by bind you use BindHelpers.attr - Timothy Perretttimo...@getintheloop.eu wrote: Jon, To read attributes, you do the following: S.attr(shorten) // = Box[String] Cheers, Tim On Aug 10, 9:44 pm, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon --~--~-~--~~~---~--~~ 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: bind with outer element?
On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- 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 -~--~~~~--~~--~--~---
[Lift] Re: bind with outer element?
Doesn't the FuncBindParam only get the element's child NodeSeq? - David Pollakfeeder.of.the.be...@gmail.com wrote: On Mon, Aug 10, 2009 at 1:44 PM, jon jonhoff...@gmail.com wrote: Hi, I have a template with the following lift:Snippit t:name shorten=true / t:foo form=POST form:name/ ... /t:foo /lift:Snippet And a snippet like: def doSnippet(x:NodeSeq):NodeSeq = { bind(t, x, name- (doName(_)), try: def myFunc(node: NodeSeq): NodeSeq = if ((node \ @shorten).isEmpty) longVersion else shortVersion bind(t, x, FuncBindParam(name, myFunc _)) You get the complete t:name shorten=true/ passed to myFunc. Thanks, David foo - (doForm(_)) ) } In the code above only the contents of the bound tags are available for doName and doForm, if I want to be able to read the attribute shorten in doName and have foo render with an enclosing form tag, how do I create the bind params? I am doing an expensive batch operation upfront, so I want everything to be in the same snippet. Thanks, Jon -- 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 -~--~~~~--~~--~--~---