Instead of yielding loc which is taking it out of the box and putting it back 
in, access foundParam inside the for loop.

-------------------------------------
Peter Robinett<pe...@bubblefoundry.com> wrote:


Thanks, David. Unfortunately I'm having a hard time figuring out how
to get the foundParam.

Using your code, I have:
val loc = for {req <- S.request; loc <- req.location} yield loc
val l = loc openOr "Couldn't open"
println(loc)
println(l)

The first println give me:
Full(Loc(View List(nodes), <function>, LinkText(<function>), List()))

While the second shows that I am opening the Box:
Loc(View List(nodes), <function>, LinkText(<function>), List())

If I try to access my Loc object, I get compilation errors. For
example, "val p = l.foundParam" leads to the error "value foundParam
is not a member of java.lang.Object." The toString method works, while
the title parameter gives me the same error. I believe I am using the
latest Lift code (I ran "mvn -U jetty:run") and feel I must be missing
something very simple here.

Any advice is much appreciated!

Peter

On Jun 29, 10:05 am, David Pollak <feeder.of.the.be...@gmail.com>
wrote:
> On Fri, Jun 26, 2009 at 6:39 PM, Peter Robinett 
> <pe...@bubblefoundry.com>wrote:
>
>
>
> > Thanks, Derek and Jeppe, your responses were very helpful. I
> > implemented Jeppe's solution and added my own snippet tag within
> > _viewTemplate.  Unfortunately, I spent the whole day trying to figure
> > out how pass the current CRUDified object to my snippet. Do I retrieve
> > it in _viewTemplate from S.params and add an attribute to the snippet
> > tag? Or just retrieve it from S in the snippet?
>
> I've just made Loc.foundParam public.  If you get the Loc from the Req from
> S (for {req <- S.request; loc <- req.location}) you can access foundParam
> which contains the current crudified object.
>
> Thanks,
>
> David
>
>
>
> > I think I'm missing
> > something fundamental with the S object and snippets. As you can tell,
> > I'm very new to Lift! Any advice is much appreciated.
>
> > Peter
>
> > On Jun 24, 11:01 am, Jeppe Nejsum Madsen <je...@ingolfs.dk> wrote:
> > > On 24 Jun 2009, Peter Robinett wrote:
>
> > > > Hi all,
>
> > > > I'm using CRUDify on one of my models and I'd like to display some
> > > > additional data on the view template. I believe that I need to
> > > > override one of the model definitions with some sort of reference to
> > > > my own XHTML file. Which one? _viewTemplate? Or perhaps the
> > > > viewTemplate method?
>
> > > If you look at the source to CRUDify, you'll see
>
> > > def viewTemplate(): NodeSeq = pageWrapper(_viewTemplate)
>
> > > where
>
> > > def pageWrapper(body: NodeSeq): NodeSeq =
> > >   <lift:surround with="default" at="content">
> > >     {
> > >       body
> > >     }
> > >   </lift:surround>
>
> > > def _viewTemplate =
> > >   <lift:crud.view>
> > >     <table id={viewId} class={viewClass}>
> > >       <crud:row>
> > >         <tr>
> > >           <td><crud:name/></td>
> > >           <td><crud:value/></td>
> > >         </tr>
> > >       </crud:row>
> > >     </table>
> > >   </lift:crud.view>
>
> > > So the simplest thing is to override _viewTemplate with something similar
> > > to the above. This should be done on the companion objects where CRUDify
> > > is mixed in....
>
> > > /Jeppe
>
> --
> 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to