It was opposite for me - I got used to "bind" and css selectors were unusual at first, but then I did realize that css selectors is better alternative. I've glimpsed to Ethan's changes - it's another evidence. As Eric said, code become more concise and much more easy to understand.
Vladimir 2011/4/5 ejc <[email protected]> > Hear, hear! > > I've started using css selectors for a personal project and love them. > Much more concise and understandable. Not to mention reducing > confusion for the web designers -- if you split the front-end back-end > responsibilities. > > > Thanks, > Eric > > On Tue, Apr 5, 2011 at 11:25 AM, Ethan Jewett <[email protected]> wrote: > > I like them a lot. I never really got "bind" but these make a lot of > sense. > > > > Ethan > > > > P.S. Actually, I think I did understand "bind", but only after seeing > > how the binding via css selectors works :-) > > > > On Tue, Apr 5, 2011 at 5:59 PM, Vladimir Ivanov <[email protected]> > wrote: > >> Ethan, it's great that you have introduced binding via css selectors! It > >> makes me feel that upgrade to Lift 2.2 wasn't useless :s) > >> > >> Vladimir > >> > >> 2011/4/5 Ethan Jewett <[email protected]> > >> > >>> Hi Dick, > >>> > >>> Currently my plan for ESME-268 is to handle it in Timeline.scala. > >>> Yesterday I got the reply and conversation functionality working there > >>> and the next step is to re-implement the resend (and add the author, > >>> which I forgot before!). If you take a look at the branch, you'll see > >>> that what I'm doing is moving away from handling the timeline using > >>> display_messages_top.js and moving towards handling it using Lift's > >>> templates and JsCmds. The advantage of doing it this way is that we > >>> will no longer need to think about the communication between the > >>> client (browser) and the server (Lift), as Lift will handle it. What > >>> we have now in the branch is a lot simpler than what we had before in > >>> some ways. > >>> > >>> Can you try handling it in Timeline.scala in the branch? That would > >>> be great. The place to look it the "renderMessage" method. At the end > >>> of this method is a piece of code that looks like: > >>> > >>> ("#avatar [src]" #> imageUrl & > >>> ".updates-box [id]" #> messageId & > >>> ".msgbody *" #> messageBody & > >>> ".supp_data *" #> suppString & > >>> ".reply [href]" #> replyHref & > >>> convTransform )(messageTemplate) > >>> > >>> What this does is transform the XML in the messageTemplate variable > >>> (at the bottom of Timeline.scala - but this will be in a template > >>> later) into different XML based on the rules outlined here: > >>> http://simply.liftweb.net/index-7.10.html > >>> > >>> So, for example: "#avatar [src]" #> imageUrl > >>> This does the following: Finds all elements with class="avatar" and > >>> makes the value of the src attribute the string imageUrl. This causes > >>> the correct image to display along with the message. > >>> > >>> The convTransform val is an example of a transform that is chosen > >>> dynamically based on some context about the message. We'll want to do > >>> something similar for the resend by adding another '&' and > >>> transformation clause after convTransform, but based on a comparison > >>> between User.currentUser (a Box[String]) and the user on the message > >>> which you get by doing m._1.author.obj.map(_.id), which I think > >>> returns a Box[Long], but it should be the same value as the String. > >>> > >>> Want to take a shot at it? If you have issues with the Scala, just > >>> send it to the list and I'll take a look. > >>> > >>> Ethan > >>> > >>> On Tue, Apr 5, 2011 at 5:03 AM, Richard Hirsch <[email protected]> > >>> wrote: > >>> > @Ethan since you are currently rewriting the timelines - if you could > >>> > add the current user to the timeline, I can deal with ESME-268 (User > >>> > should not be offered the option to "resend" their own messages - it > >>> > has no effect) > >>> > > >>> > D. > >>> > > >>> > >> > >> > >> > >> -- > >> Best Regards, > >> Vladimir Ivanov > >> > > > -- Best Regards, Vladimir Ivanov
