Forum: Ruby on Rails Updating set of images with RJS

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Justin W. (Guest)
on 2007-01-19 17:31
(Received via mailing list)
I allow users to dynamically add and remove phone numbers with Ajax.
They can then mark the primary number by clicking on a star which
triggers an Ajax method to update the primary number.

That method calls an RJS template that I need to modify the newly
selected star as primary by changing its image to be star.gif & making
the other images become star_off.gif.

I am able to get the star image updating working partially, but I am
not sure how to pass the index parameter to my RJS call so that
everything will stay numbered correctly in my array.

I am also not sure how to go about converting all non-primary images
(including the previous primary) to be star_off while leaving the new
primary as star_on.

Relevant code below.   Help is appreciated.  Thanks!


<%= link_to_remote "#{star_image(phone, index)}", :url => {:controller
=> 'contacts', :action =>'mark_as_primary_phone', :id => phone, :index
=> index} %>


page.replace 'phone_off', :partial => "/shared/star", :locals => {
:phone => @phone}
Justin W. (Guest)
on 2007-09-26 00:46
(Received via mailing list)
anyone?    im still stumped on this one.

- j
This topic is locked and can not be replied to.