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 Pollak<feeder.of.the.be...@gmail.com> wrote: On Wed, Aug 5, 2009 at 8:44 PM, Naftoli Gugenheim <naftoli...@gmail.com>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 --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---