Hi! I have decided to go ahead with HAML and in some ways it feels natural,
and in others I feel I am missing something important. Here''s my
question du
jour:
I have a list of catalog items each of which people can add to a cart. When
they add an item, I want a little snippet below the item image to update the
count of that item. E.g. (7 pairs of these shoes in your cart). I''m
using
link_to_remote and rjs to update, but it requires that I have
programmatically named DOM elements. Such as:
<div id="item034">abc</div>
I don''t see how to explain to HAML that I want to specify the id at
runtime.
%item{:id => ???}
doesn''t give me an opportunity to evaluate an expression as the list
item is
being evaluated. How are others solving this problem?
Thanks
--
View this message in context:
http://www.nabble.com/HAML-and-Ajax-in-Lists-tf2341662.html#a6517355
Sent from the RubyOnRails Users mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
This should work:
%item{:id => "item#{counter}"}
I''m using something like this:
%tr.{:class => "#{even_odd(counter)}"}
for even-odd class names for table rows.
On 9/27/06, s.ross <cwdinfo-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
>
>
> Hi! I have decided to go ahead with HAML and in some ways it feels
> natural,
> and in others I feel I am missing something important. Here''s my
question
> du
> jour:
>
> I have a list of catalog items each of which people can add to a cart.
> When
> they add an item, I want a little snippet below the item image to update
> the
> count of that item. E.g. (7 pairs of these shoes in your cart).
I''m using
> link_to_remote and rjs to update, but it requires that I have
> programmatically named DOM elements. Such as:
>
> <div id="item034">abc</div>
>
> I don''t see how to explain to HAML that I want to specify the id
at
> runtime.
>
> %item{:id => ???}
>
> doesn''t give me an opportunity to evaluate an expression as the
list item
> is
> being evaluated. How are others solving this problem?
>
> Thanks
> --
> View this message in context:
> http://www.nabble.com/HAML-and-Ajax-in-Lists-tf2341662.html#a6517355
> Sent from the RubyOnRails Users mailing list archive at Nabble.com.
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---
hcatlin-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2006-Oct-18 13:14 UTC
Re: HAML and Ajax in Lists
Sorry for the tardy reply. I didn''t see this post.
We have implemented RJS style "simplyhelpful" helpers with dom-element
naming. Check out the README file (almost a tutorial) to see all of the
stuff you can do with HAML.
%div[@item]
Assuming item is of class Item and id=32, then that would print
<div class=''item''
id=''item_32''></div>
I''m actually confused by your comment that you can''t evaluate
the
attributes { } during run time. They absolutely *are* evaluated at
runtime. You are free to do #item{:id => @item.id}... we are just
providing a helper with [] to doing that and use rails-standard naming
practices.
-hampton.
s.ross wrote:> Hi! I have decided to go ahead with HAML and in some ways it feels natural,
> and in others I feel I am missing something important. Here''s my
question du
> jour:
>
> I have a list of catalog items each of which people can add to a cart. When
> they add an item, I want a little snippet below the item image to update
the
> count of that item. E.g. (7 pairs of these shoes in your cart).
I''m using
> link_to_remote and rjs to update, but it requires that I have
> programmatically named DOM elements. Such as:
>
> <div id="item034">abc</div>
>
> I don''t see how to explain to HAML that I want to specify the id
at runtime.
>
> %item{:id => ???}
>
> doesn''t give me an opportunity to evaluate an expression as the
list item is
> being evaluated. How are others solving this problem?
>
> Thanks
> --
> View this message in context:
http://www.nabble.com/HAML-and-Ajax-in-Lists-tf2341662.html#a6517355
> Sent from the RubyOnRails Users mailing list archive at Nabble.com.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---