aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-04-18 05:15:17 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-04-18 05:15:17 +0000
commitbceb88ef9c402a722caa7441a53f768aa14ab709 (patch)
tree677654bd1e536b5ec52cc7fc7b8c8836da0bac18
parent76690111d52dca6c1992ff6c9f9962c889b40c5d (diff)
downloadrails-bceb88ef9c402a722caa7441a53f768aa14ab709.tar.gz
rails-bceb88ef9c402a722caa7441a53f768aa14ab709.tar.bz2
rails-bceb88ef9c402a722caa7441a53f768aa14ab709.zip
Fixed that you can now pass an alternative :href option to link_to_function/remote in order to point to somewhere other than # if the javascript fails or is turned off. You can do the same with form_remote_tag by passing in :action. #1113 [Sam Stephenson]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1200 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb6
2 files changed, 5 insertions, 3 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 6bafbf53c3..e571a2cc87 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that you can now pass an alternative :href option to link_to_function/remote in order to point to somewhere other than # if the javascript fails or is turned off. You can do the same with form_remote_tag by passing in :action. #1113 [Sam Stephenson]
+
* Added Request#xml_http_request? (and an alias xhr?) to that'll return true when the request came from one of the Javascript helper methods (Ajax). This can be used to give one behavior for modern browsers supporting Ajax, another to old browsers #1127 [Sam Stephenson]
* Added assert_tag and assert_no_tag as a much improved alternative to the deprecated assert_template_xpath_match #1126 [Jamis Buck]
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 7e11e09c1d..35a09b2e4e 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -29,7 +29,7 @@ module ActionView
def link_to_function(name, function, html_options = {})
content_tag(
"a", name,
- html_options.symbolize_keys.merge(:href => "#", :onclick => "#{function}; return false;")
+ {:href => "#", :onclick => "#{function}; return false;"}.merge(html_options.symbolize_keys)
)
end
@@ -87,13 +87,13 @@ module ActionView
def form_remote_tag(options = {})
options[:form] = true
- options[:html] ||= { }
+ options[:html] ||= {}
options[:html][:onsubmit] = "#{remote_function(options)}; return false;"
tag("form", options[:html], true)
end
- # Returns a button input tag that will submit form using XMLHttpRequest in tghe background instead of regular
+ # Returns a button input tag that will submit form using XMLHttpRequest in the background instead of regular
# reloading POST arrangement. <tt>options</tt> argument is the same as in <tt>form_remote_tag</tt>
def submit_to_remote(name, value, options = {})
options[:with] = 'Form.serialize(this.form)'