Snippet attribute pass through

9 views
Skip to first unread message

ced

unread,
Feb 1, 2010, 10:57:15 AM2/1/10
to Lift
I want to set a node attribute in the template markup exactly like it
is done in example 7.13 from the Lift Book. I'll paste it here:

// the markup
<lift:Ledger.balance> <ledger:time ledger:id="myId"/>
</lift:Ledger.balance>

// The snippet class
class Ledger { def balance (content : NodeSeq ) : NodeSeq = {
bind ("ledger", content, "time" -> <span>{(new
java.util.Date).toString}</span>)
}
}

Unfortunately I can't get it to work. Is there something I have to set/
enable to get this feature working? I'm using Lift 1.1-M8

Thanks,
Chris

Marius

unread,
Feb 1, 2010, 11:03:46 AM2/1/10
to Lift
Replace your bind with:

bind ("ledger", content, "time" -%> <span>{(new
java.util.Date).toString}</span>)

ledger:id is not anymore preserved as after the was out this was
considered a not intended feature and got moved. -%> should do what
you want.

Br's,
Marius

Marius

unread,
Feb 1, 2010, 11:06:10 AM2/1/10
to Lift
I'm eating letters "as after the was out" should be "as after the the
book was out" :D

Naftoli Gugenheim

unread,
Feb 1, 2010, 11:39:32 AM2/1/10
to lif...@googlegroups.com
Anyone want to fix the book? :)
Anyway, once you're using -%> you want it to be id, not ledger:id.

-------------------------------------
Marius<marius...@gmail.com> wrote:

--
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to lif...@googlegroups.com.
To unsubscribe from this group, send email to liftweb+u...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

ced

unread,
Feb 1, 2010, 11:39:52 AM2/1/10
to Lift
Thanks for the fast response, Darius.

I tried it out and it seem that the "-%>" operator puts the attributes
through untouched, so one has to write <ledger:time id="myId"/>
instead of the former prefixed version <ledger:time ledger:id="myId"/
>.

Cheers,
Chris

Marius

unread,
Feb 1, 2010, 2:10:05 PM2/1/10
to Lift
Well the book reflects Lift at that point in time. Since then there
were quite a few updates. I know Derek at some point tried to keep it
up to date but I'm not sure now.

This is not about "fixing" the book.

Br's,
Marius

On 1 feb., 18:39, Naftoli Gugenheim <naftoli...@gmail.com> wrote:
> Anyone want to fix the book? :)
> Anyway, once you're using -%> you want it to be id, not ledger:id.
>
> -------------------------------------
>

Marius

unread,
Feb 1, 2010, 2:20:38 PM2/1/10
to Lift
Yes, sorry for not being more explicit about -%> preserving
attributes.

Br's,
Marius

Reply all
Reply to author
Forward
0 new messages