Support data-name attribute selection with a shortcut in CSS Selector Transforms so that id and class do not have to be over-loaded with server-side meaning. So, perhaps ";foo" #> "bar" replaces all elements with data-name="foo" with "bar"
Imported from Assembla: http://www.assembla.com/spaces/liftweb/tickets/1185
Hi, just wondering if this is still planned to be in 2.5-M5. I really like this idea!
Lift 3.0 will introduce any-attribute snippet binding (see http://blog.goodstuff.im/lift_30 ). Personally, I think the close mapping to CSS is a good thing, not a bad one. You can match arbitrary attributes in the actual transforms by doing e.g. "data-name=foo" #> "bar".
"data-name=foo" #> "bar"
Sure you can already match arbitrary attributes, but "data-name=foo" #> "bar" can clutter up your snippet if you use it all over. Have a special symbol (like # for id and . for classes) would make our snippets clean and encourage people not to use ids and classes for lift purposes.
I believe what we're talking about here is:
"data-name=foo" #> "bar"
";foo" #> "bar"
Not sure if this conversation should be moved to the list… I have three points to make:
I'd be curious to see the markup and what you're wanting to do with it to see if there's a better way to improve the markup rather than adding complexity to Lift. If you're willing to share it, I would suggest posting to the Lift list and referencing this issue.
Basically the idea is to further separate design from code. CSS classes should be used for.. well.... CSS. By using it for css AND lift, things can get muddled. For example, you could have a conflict where your designer wants to change the name of a class, but you're using it in a lift snippet. By separating them out and leaving classes and ids for css and js and using a data attribute for lift stuff, you can avoid some confusion and allow your designer to do his work and your coder to do his without them messing up each other up.
You should read throguh https://groups.google.com/forum/?fromgroups=#!topic/liftweb/lDY9NTob2W0.
I believe that's the thread where this idea got started.
I agree, this is becoming a conversation that should probably be taking place in the LIft Group rather than here.
This has already been discussed in a thread (https://groups.google.com/forum/?fromgroups=#!topic/liftweb/lDY9NTob2W0). That's why DPP created this issue. But that was awhile ago, so I was just wondering if there was still a plan to include this in a future release.
For what it's worth, I read through the thread before posting here :) I just wasn't convinced.
You can already use data-name:
"data-name=wombat" #> thing
It's just there's no shortcut for it.
@andreak - Yeah, we use something similar at my job. Any class names that are used for lift transforms have a "_" in front. e.g. class="_addresses addresses", class="_name name" then in the snippet "._name" #> user.name
@dpp - So is there still a plan to make a shortcut for data-name and include it in a future lift release?
I don't know what you mean by "plans." The ticket is open and I haven't closed it.
I write Lift code that I need or that I'm paid to write. If I'm in the CSS Selector Transforms, I may drop this code in. Maybe another committer will get to it before I have a chance.
In the mean time, you can write a method (and do implicit magic with it) to transform ";xxxx" ##> xxx into "data-name=xxxx" #> xxxx
";xxxx" ##> xxx
"data-name=xxxx" #> xxxx
Fair enough. Since it's open and marked at 2.5 M5, I was just curious if that meant it was probably going to be in that release.
I thought about writing an implicit method and doing it myself, but my scala-foo is still weak. Some tips would be appreciated or I can post to the google group to get some help!
This looks like it's been in Lift 3 for a while, and this thread indicates that it's available in Lift 2.6, as well (unfortunately :p).