diff options
Diffstat (limited to 'actionpack')
-rw-r--r-- | actionpack/CHANGELOG | 2 | ||||
-rw-r--r-- | actionpack/lib/action_view/helpers/javascript_helper.rb | 6 |
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)' |