Marston A.
2006-Apr-30 00:13 UTC
[Rails] link_to_remote possible with :class AND progress indicators?
I have the following code: <code> <span id="loader" style="display:none;"> <%= image_tag "spinner.gif" %></span> <strong><%= link_to_remote(''Add Entry'', {:update => ''add-entry'', :url => { :action => "show_add_entry" }}, :loading => "Element.show(''loader'')", :complete => "Element.hide(''loader'')", :class => "create") %></strong> </code> It seems that I can either have a :class styling the link and not have the progress indicators via :loading/:complete or the other way around but not both. It there a way to modify this code to have my link styled via my class and also have the :loading/:complete callbacks work on click as well? Thanks. -- Posted via http://www.ruby-forum.com/.
Bryan Duxbury
2006-Apr-30 13:42 UTC
[Rails] Re: link_to_remote possible with :class AND progress indicat
Marston A. wrote:> I have the following code: > > <code> > > <span id="loader" style="display:none;"> > <%= image_tag "spinner.gif" %></span> > > <strong><%= link_to_remote(''Add Entry'', {:update => ''add-entry'', > :url => { :action => "show_add_entry" }}, > :loading => "Element.show(''loader'')", > :complete => "Element.hide(''loader'')", > :class => "create") %></strong> > > </code> > > It seems that I can either have a :class styling the link and not have > the progress indicators via :loading/:complete or the other way around > but not both. It there a way to modify this code to have my link styled > via my class and also have the :loading/:complete callbacks work on > click as well? Thanks.The problem with your code is that :class should be in another hash. link_to_remote takes two hashes, options and html_options. By closing the first hash (the one with :update), you''re putting the loading and complete ones into html_options. Try reorganizing your options a little and it should work. -- Posted via http://www.ruby-forum.com/.