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 <[email protected]>wrote: > > 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. I don't understand why the example doesn't allow for alternatives that repeat. > > > ------------------------------------- > David Pollak<[email protected]> wrote: > > On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim <[email protected] > >wrote: > > > > > 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 where you select the client, if the client is > None, > > then it displays an interface to select a client. If it's set to a Some > then > > it displays the client's details with a button to unset it. This pattern > is > > repeated. > > My current strategy is to have two elements, req:noClient and req:client, > > which have different xhtml contents. Then in the snippet I bind them to > two > > NodeSeq functions, one that binds useful contents when the client is None > > and returns NodeSeq.Empty otherwise; and another function that binds when > > it's a Some and returns Empty otherwise. However, it seems to be somewhat > > redundant in theory. > > So does anyone have a better way of switching view parts? > > > If it's repeated, then <lift:embed /> the part that you need. > > <lift:MaybeClient> > <client:yes><lift:embed what="/templates/client_edit.html"/></client:yes> > <client:no><lift:embed what="/templates/client_chooser.html"/><client:no> > </lift:MaybeClient> > > > > > > > Thanks. > > > > > > > > > > > > > > -- > 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 > > > > > > -- 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 [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 -~----------~----~----~----~------~----~------~--~---
