[Lift] Re: Attributes question

2009-10-15 Thread Naftoli Gugenheim
There's also the _id_> arrow, which uses the element's name as the id attribute. - Derek Chen-Becker wrote: Is that now part of the Lift library, or is that hand-coded? On Thu, Oct 15, 2009 at 12:59 PM, Timothy Perrett wrote: > Im using -%> in production cod

[Lift] Re: Attributes question

2009-10-15 Thread Naftoli Gugenheim
Yes, David added it. - Derek Chen-Becker wrote: Is that now part of the Lift library, or is that hand-coded? On Thu, Oct 15, 2009 at 12:59 PM, Timothy Perrett wrote: > Im using -%> in production code and personally i think it looks fine! > Cheers, Tim > > On

[Lift] Re: Attributes question

2009-10-15 Thread Derek Chen-Becker
Is that now part of the Lift library, or is that hand-coded? On Thu, Oct 15, 2009 at 12:59 PM, Timothy Perrett wrote: > Im using -%> in production code and personally i think it looks fine! > Cheers, Tim > > On 15 Oct 2009, at 19:12, Derek Chen-Becker wrote: > > Did this discussion ever lead to a

[Lift] Re: Attributes question

2009-10-15 Thread Timothy Perrett
Im using -%> in production code and personally i think it looks fine! Cheers, Tim On 15 Oct 2009, at 19:12, Derek Chen-Becker wrote: > Did this discussion ever lead to anything concrete? I just had to > update part of the book that talks about this and I added a note to > follow-up in case w

[Lift] Re: Attributes question

2009-08-17 Thread marius d.
One small advice ... your code would probably be be read by more people if some minimal formatting is applied :) ... I can imagine you didn't do it on purpose though :) Actually I like it. Just something really unimportant and subjective: how do you feel about ->> instead of %> ? (I understood y

[Lift] Re: Attributes question

2009-08-17 Thread Naftoli Gugenheim
Hi, sorry, not sure why I didn't see your message earlier. Strange... Has anyone written any code to address this topic in the meantime? In case not, here's all the code I've written for such purposes; tell me what you think. def keepAttrs(elem: Elem) = (ns: NodeSeq) => BindHelpers.currentNode mat

[Lift] Re: Attributes question

2009-08-14 Thread marius d.
IMHO: The problem with "name" some_new_operator_beside_-> expr would lead to a handful of overloading as -> in SuperArrowAssoc. Looks a little messy to me. Looks like we already have a way to do this: import Helpers._ "name" -> {node: NodeSeq => mixinAttributes(expr _that_yields_an_Elem) (no

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
As I mentioned, I wrote some code that allows you to use %> instead of -> to preserve the attributes. (I chose it because the % symbol is used to merge attributes to an Elem.) The right side can be an Elem or a Box/Option of an Elem. What do people think of this syntax? P.S. Another way is to a

[Lift] Re: Attributes question

2009-08-14 Thread marius d.
The book exposes current functionality for Lift 1.0. If functionality X was not intended to be there is a different story, but regardless it is there and the way I see it it is OK to be in the book. Personally I don't see it as defect as preserving attributes (to the top level resulting NodeSeq)

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
By the way, there does seem to be some other kind of built in attribute binding mechanism (BindWithAttr, etc.). How does it work? - David Pollak wrote: On Fri, Aug 14, 2009 at 9:55 AM, Naftoli Gugenheim wrote: > > Where above? The contents of my messages s

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
I guess #2 was what I was looking for. :) I wrote some code that enables me to bind "query" %> SHtml.text(clientQuery, clientQuery=_) which means you're actually binding to a function that preserves the input node's attributes. Does anyone like/dislike the syntax or feature? Thanks. ---

[Lift] Re: Attributes question

2009-08-14 Thread David Pollak
On Fri, Aug 14, 2009 at 9:55 AM, Naftoli Gugenheim wrote: > > Where above? The contents of my messages send 35 minutes ago: This has nothing to do with snippets. This is below the level of the snippet. This is the operation of the bind() operation (if I understand your question correctly.) W

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
Where above? Do mean when you said that binding is about inserting xml in well defined points? If so, I understand that, but it would be convenient if there was a simple way that SHtml inputs could take their attributes from the view. - David Pollak wrote: O

[Lift] Re: Attributes question

2009-08-14 Thread David Pollak
On Fri, Aug 14, 2009 at 9:43 AM, Naftoli Gugenheim wrote: > > The book seems to think it's intentional! I'm not sure how the code crept in, but it's wrong and should not have been part of Lift. > > But why can't unprefixed nodes by preserved automatically? I explained this above. > Maybe t

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
The book seems to think it's intentional! But why can't unprefixed nodes by preserved automatically? Maybe there could be a setting? Thanks. - David Pollak wrote: On Fri, Aug 14, 2009 at 9:23 AM, Naftoli Gugenheim wrote: > > Exactly! > >

[Lift] Re: Attributes question

2009-08-14 Thread David Pollak
On Fri, Aug 14, 2009 at 9:23 AM, Naftoli Gugenheim wrote: > > Exactly! > > - > Derek Chen-Becker wrote: > > Basically, you're asking why a bind tag like > > > > doesn't preserve the id and class attrs when it binds, but > > > > does? > If bind("ledger", , "en

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
Exactly! - Derek Chen-Becker wrote: Basically, you're asking why a bind tag like doesn't preserve the id and class attrs when it binds, but does? Derek On Fri, Aug 14, 2009 at 10:08 AM, Naftoli Gugenheim wrote: > > Of course you can access it from the

[Lift] Re: Attributes question

2009-08-14 Thread David Pollak
On Fri, Aug 14, 2009 at 9:08 AM, Naftoli Gugenheim wrote: > > Of course you can access it from the snippet. But if you want it to be > output automatically, then you prefix it with whatever the node's prefix is. > In other words, by default it's not outputted. This has nothing to do with snippet

[Lift] Re: Attributes question

2009-08-14 Thread Derek Chen-Becker
Basically, you're asking why a bind tag like doesn't preserve the id and class attrs when it binds, but does? Derek On Fri, Aug 14, 2009 at 10:08 AM, Naftoli Gugenheim wrote: > > Of course you can access it from the snippet. But if you want it to be > output automatically, then you prefix

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
Of course you can access it from the snippet. But if you want it to be output automatically, then you prefix it with whatever the node's prefix is. In other words, by default it's not outputted. - David Pollak wrote: On Thu, Aug 13, 2009 at 9:06 PM, Naftoli

[Lift] Re: Attributes question

2009-08-14 Thread David Pollak
On Thu, Aug 13, 2009 at 9:06 PM, Naftoli Gugenheim wrote: > > What I would like to do: > NameĀ  class="special" style="vertical-align: top" maxlength="5" tabindex="1" /> > Okay, just a little contrived... > My understanding is you can do this by prefixing the attribute with > "lift:"; otherwise it

[Lift] Re: Attributes question

2009-08-14 Thread Naftoli Gugenheim
Yes, 7.12 vs. 7.13. Apparently the prefix is not supposed to be lift like I thought but the prefix of the node it belongs to. But I still have the question. It would seem more logical that just like nodes, attributes that are prefixed are not html, and html attributes should not be prefixed. Wh

[Lift] Re: Attributes question

2009-08-14 Thread marius d.
What listing from the book are you referring to ? 7.13 ? and the code: class Ledger { def balance (content : NodeSeq ) : NodeSeq = { bind ("ledger", content, "time" -> {(new java.util.Date).toString}) } } would output Sat Mar 28 16:43:48 EET 2009. so ledger:id was preserved in the output

[Lift] Re: Attributes question

2009-08-13 Thread Naftoli Gugenheim
What I would like to do: NameĀ  Okay, just a little contrived... My understanding is you can do this by prefixing the attribute with "lift:"; otherwise it will not be output but is available to the snippet code, i.e., without the prefix you are making an attribute available to the snippet but th

[Lift] Re: Attributes question

2009-08-13 Thread David Pollak
On Thu, Aug 13, 2009 at 7:24 PM, Naftoli Gugenheim wrote: > > Why was the decision made, if I understand correctly, that normal > attributes are not preserved in a bound node, and are are only available for > the snippet's usage, and if you want the attribute to be "sticky" you have > to prefix it