I''d like to use on browsers supporting AJAX link_to_remote or button_to_function/remote_function and on rest button_to and link_to. How can I determine it? -- I''ve probably left my head... somewhere. Please wait untill I find it. Homepage (pl_PL): http://uzytkownik.jogger.pl/ (GNU/)Linux User: #425935 (see http://counter.li.org/) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maciej Piechotka wrote:> I''d like to use on browsers supporting AJAX link_to_remote or > button_to_function/remote_function and on rest button_to and link_to. > > How can I determine it?Send both systems, and let the browser figure it out, like this: <noscript> <%= my manual buttons %> </noscript> <%= javascript_tag ... %> A browser without JavaScript will render the HTML inside <noscript>, so put your buttons there. And only a browser _with_ JavaScript will respect the <script> tags that javascript_tag inserts, so I suspect you could put ''document.write'' calls in there that insert your link_to_remote tags. /Pragmatic Ajax/ has a great section on degradability, but I don''t know if it has the <noscript> trick. -- Phlip http://www.oreilly.com/catalog/9780596510657/ "Test Driven Ajax (on Rails)" assert_xpath, assert_javascript, & assert_ajax --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Fri, 11 May 2007 18:16:32 -0700, Phlip wrote:> Maciej Piechotka wrote: > >> I''d like to use on browsers supporting AJAX link_to_remote or >> button_to_function/remote_function and on rest button_to and link_to. >> >> How can I determine it? > > Send both systems, and let the browser figure it out, like this: > > <noscript> > <%= my manual buttons %> > </noscript> > > <%= javascript_tag ... %> > > A browser without JavaScript will render the HTML inside <noscript>, so > put your buttons there. And only a browser _with_ JavaScript will > respect the <script> tags that javascript_tag inserts, so I suspect you > could put ''document.write'' calls in there that insert your > link_to_remote tags. > > /Pragmatic Ajax/ has a great section on degradability, but I don''t know > if it has the <noscript> trick.Thank you - sometimes I forget about those base (x)html tricks... Regards -- I''ve probably left my head... somewhere. Please wait untill I find it. Homepage (pl_PL): http://uzytkownik.jogger.pl/ (GNU/)Linux User: #425935 (see http://counter.li.org/) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Maciej, > I''d like to use on browsers supporting AJAX link_to_remote or > button_to_function/remote_function and on rest button_to and link_to. link_to_remote offers fallback for js-challenged browsers, so this code would do what you need :(untested) <%= link_to_remote "Delete", {:url => {:action => "delete", :id => id} }, ## <-- if JS available {:href => url_for(:action => "delete",:id => id)} ## <- if NO JS %> , and in the controller you''d use ''respond_to'' to handle both calls within one action. Alain Ravet -------- blog.ravet.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 -~----------~----~----~----~------~----~------~--~---
On Sat, 12 May 2007 12:33:56 +0200, Alain Ravet wrote:> Maciej, > > > I''d like to use on browsers supporting AJAX link_to_remote or > > button_to_function/remote_function and on rest button_to and > > link_to. > > link_to_remote offers fallback for js-challenged browsers, so this code > would do what you need :(untested) > > <%= link_to_remote "Delete", > {:url => {:action => "delete", :id => id} }, ## <-- if JS > available {:href => url_for(:action => "delete",:id => id)} ## <- > if NO JS > %> > > > , and in the controller you''d use ''respond_to'' to handle both calls > within one action. > > > > Alain RavetThanks. That is just what I wanted. Regards -- I''ve probably left my head... somewhere. Please wait untill I find it. Homepage (pl_PL): http://uzytkownik.jogger.pl/ (GNU/)Linux User: #425935 (see http://counter.li.org/) --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---