[Lift] Re: Alternate part of view

2009-08-11 Thread Naftoli Gugenheim
Great. So what kind of syntax do you want to see? What do you think of my bindSwitch syntax? - georgegeo...@mattandgeorge.com wrote: I've been following this thread with interest because I have a very similar use case. I also want to show different form

[Lift] Re: Alternate part of view

2009-08-11 Thread george
I will have a think about it and get back to you. On Aug 11, 1:38 pm, Naftoli Gugenheim naftoli...@gmail.com wrote: Great. So what kind of syntax do you want to see? What do you think of my bindSwitch syntax? - georgegeo...@mattandgeorge.com wrote:

[Lift] Re: Alternate part of view

2009-08-10 Thread David Pollak
On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name

[Lift] Re: Alternate part of view

2009-08-10 Thread Naftoli Gugenheim
The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be used inside a bind. You can put the alternatives inside a dedicated parent xml

[Lift] Re: Alternate part of view

2009-08-10 Thread David Pollak
On Mon, Aug 10, 2009 at 11:18 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: The problem with using the template methods is that they pull the node out of context. So if I need to let the view html file decide how everything is assembled, then these calls to the template methods have to be

[Lift] Re: Alternate part of view

2009-08-10 Thread Naftoli Gugenheim
By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc. extract data out of context as oppo'sed to bind which is in place. And if indeed

[Lift] Re: Alternate part of view

2009-08-10 Thread David Pollak
On Mon, Aug 10, 2009 at 11:29 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: By context I mean where it is in the xml. For example, br's between the switch and everything else. In other words, your code implements a switch. But where are you putting it back in the view? chooseTemplate etc.

[Lift] Re: Alternate part of view

2009-08-10 Thread Naftoli Gugenheim
It's not that it doesn't do what my code does. But in the long run it doesn't sound shorter. Also it's not totally based on boxes anymore. Also, my proposal would allow me to write: bindSwitch(req, xhtml, Seq(hasClient, noClient), {(ns:NodeSeq) = xxx match { case yyy = 0 - bind(client, ns,

[Lift] Re: Alternate part of view

2009-08-10 Thread Naftoli Gugenheim
I sent my last message before I saw your last message, sorry. You made a very valid point that I didn't think of--to split the snippet into a number of snippets. However that doesn't help everywhere. For example: (breaking it into 2 messages) - David

[Lift] Re: Alternate part of view

2009-08-10 Thread Naftoli Gugenheim
For example, I have requests. Every request is of a particular nature. Every nature specifies a set of location types--for example a Transportation request has a From and a To--and each type has a set of allowed location kinds--for example, transportation can be from/to a street address,

[Lift] Re: Alternate part of view

2009-08-09 Thread Naftoli Gugenheim
Maybe I should write a bindSwitch method? It could take a list of strings out of which one should be bound and the others should be replaced with NodeSeq.Empty; and a function that returns a (Int, NodeSeq) indicacating which one to use and what to replace it with. Would people be interested in

[Lift] Re: Alternate part of view

2009-08-09 Thread David Pollak
I think you're approaching the issue backwards... I'd figure out if you have a client first and dispatch based on that... I'll work on some code late morning tomorrow (Monday) for you. On Thu, Aug 6, 2009 at 9:28 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: Here's some view xhtml:

[Lift] Re: Alternate part of view

2009-08-09 Thread Naftoli Gugenheim
What do you mean by dispatch? This is all taking place inside one screen, just parts of the screen each change between one set of xhtml and another. It would be overkill to split the view into separate files -- the html file has about 60 lines (not counting some that are commented out :) ).

[Lift] Re: Alternate part of view

2009-08-09 Thread David Pollak
On Sun, Aug 9, 2009 at 6:44 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: What do you mean by dispatch? This is all taking place inside one screen, just parts of the screen each change between one set of xhtml and another. It would be overkill to split the view into separate files -- the

[Lift] Re: Alternate part of view

2009-08-06 Thread David Pollak
On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim naftoli...@gmail.comwrote: What's the smartest / most concise way to achieve the following in the corresponding view xhtml and snippet code: Parts of the view have to change, depending on whether something is set. For example, in the area

[Lift] Re: Alternate part of view

2009-08-06 Thread Naftoli Gugenheim
No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view has several pairs of alternatives. - David Pollakfeeder.of.the.be...@gmail.com wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim

[Lift] Re: Alternate part of view

2009-08-06 Thread David Pollak
I really need to see the resulting view code that you'd like to see depending on the conditions. On Thu, Aug 6, 2009 at 7:47 AM, Naftoli Gugenheim naftoli...@gmail.comwrote: No, I meant that this pattern of parts of the view being alternatives to each other repeats, in other words the view

[Lift] Re: Alternate part of view

2009-08-06 Thread Naftoli Gugenheim
Here's some view xhtml: req:noClient label for=clientqueryClient /label client:query id=clientquery size=5/ client:set / /req:noClient req:client Client client:unset / client:editclient:name //client:editbr / client:details / /req:client hr / And here's some snippet code:

[Lift] Re: Alternate part of view

2009-08-05 Thread marius d.
Please see chooseTemplate from Helpers._ (It's actually defined in BindHelpers) For examples see: \sites\example\src\main\webapp\guess.html \sites\example\src\main\scala\net\liftweb\example\snippet \CountGame.scala .. see if that helps you case. Br's, Marius On Aug 6, 6:44 am, Naftoli

[Lift] Re: Alternate part of view

2009-08-05 Thread Naftoli Gugenheim
It doesn't, because it has to replace its contents bound, and the other view part has to be replaced with nothing, so it's less concise than FuncBindParams. - marius d.marius.dan...@gmail.com wrote: Please see chooseTemplate from Helpers._ (It's actually