After looking at the link_to_remote tag for the first time, I found it broke when javascript was disabled. Below is one possible solution I found and would like to suggest that this idea is promoted into rails. # # provide fix for link_to_remote tag when javascript is not enabled def link_to_remote_fix(text, options) link_to_remote text, options, :href => url_for( options[:url] ) end any better suggestions on how this can be done? cheers -- Posted via http://www.ruby-forum.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?hl=en -~----------~----~----~----~------~----~------~--~---
Peter De Berdt
2007-May-11 15:23 UTC
Re: link_to_remote fix, should this be added to edge rails?
On 11 May 2007, at 00:17, adam wrote:> After looking at the link_to_remote tag for the first time, I found it > broke when javascript was disabled. > > Below is one possible solution I found and would like to suggest that > this idea is promoted into rails. > > # > # provide fix for link_to_remote tag when javascript is not > enabled > def link_to_remote_fix(text, options) > link_to_remote text, options, :href => url_for( options > [:url] ) > end > > any better suggestions on how this can be done?Your method is correct, you could however alias link_to_remote to old_link_to_remote and then override the link_to_remote method. This way, all your existing code will benefit from it. Keep in mind that you need to provide seperate normal pages for each action you call via link_to_remote so that it will render if Javascript is disabled. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
Looks like someone else had the same feature request: http://dev.rubyonrails.org/ticket/7904 I think it''s a good idea, but maybe as an option. A lot of the time you don''t want your link_to_remote to actually get triggered if Javascript is disabled because the end point is an rjs action or something else not for human consumption. On May 11, 6:17 am, adam <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> After looking at the link_to_remote tag for the first time, I found it > broke when javascript was disabled. > > Below is one possible solution I found and would like to suggest that > this idea is promoted into rails. > > # > # provide fix for link_to_remote tag when javascript is not enabled > def link_to_remote_fix(text, options) > link_to_remote text, options, :href => url_for( options[:url] ) > end > > any better suggestions on how this can be done? > > cheers > > -- > Posted viahttp://www.ruby-forum.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?hl=en -~----------~----~----~----~------~----~------~--~---