diff options
author | Marcel Molina <marcel@vernix.org> | 2007-11-06 19:34:21 +0000 |
---|---|---|
committer | Marcel Molina <marcel@vernix.org> | 2007-11-06 19:34:21 +0000 |
commit | 563d9efdf35d2bf8ea3640e720519b4bb1a30778 (patch) | |
tree | 1344248098701b9d3ccf4cf4c28193dd807fa891 | |
parent | 0230fc96ec0807810c3e67fa4967daaf204d618e (diff) | |
download | rails-563d9efdf35d2bf8ea3640e720519b4bb1a30778.tar.gz rails-563d9efdf35d2bf8ea3640e720519b4bb1a30778.tar.bz2 rails-563d9efdf35d2bf8ea3640e720519b4bb1a30778.zip |
Explain how to use the :href option for link_to_remote to degrade gracefully in the absence of JavaScript. Closes #8911 [vlad]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8100 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/prototype_helper.rb | 11 |
2 files changed, 13 insertions, 0 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index a866c2a22b..59b45f2df7 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Explain how to use the :href option for link_to_remote to degrade gracefully in the absence of JavaScript. Closes #8911 [vlad] + * Disambiguate :size option for text area tag. Closes #8955 [redbeard] * Fix broken tag in assert_tag documentation. Closes #9037 [mfazekas] diff --git a/actionpack/lib/action_view/helpers/prototype_helper.rb b/actionpack/lib/action_view/helpers/prototype_helper.rb index eee2c6a2f4..b7da182b35 100644 --- a/actionpack/lib/action_view/helpers/prototype_helper.rb +++ b/actionpack/lib/action_view/helpers/prototype_helper.rb @@ -136,6 +136,17 @@ module ActionView # default this is the current form, but # it could just as well be the ID of a # table row or any other DOM element. + # + # You can generate a link that uses AJAX in the general case, while + # degrading gracefully to plain link behavior in the absence of + # JavaScript by setting <tt>html_options[:href]</tt> to an alternate URL. + # Note the extra curly braces around the <tt>options</tt> hash separate + # it as the second parameter from <tt>html_options</tt>, the third. + # + # Example: + # link_to_remote "Delete this post", + # { :update => "posts", :url => { :action => "destroy", :id => post.id } }, + # :href => url_for(:action => "destroy", :id => post.id) def link_to_remote(name, options = {}, html_options = nil) link_to_function(name, remote_function(options), html_options || options.delete(:html)) end |