Permalink
Browse files

Added documentation and fixed an ajax bug

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent e1ce180 commit 4e60fe3ef3474834a9880f3cdd2a47f8efa99bc5 @dhh dhh committed Mar 22, 2005
View
@@ -1,6 +1,6 @@
-*SVN*
+*0.8.0* (22th March, 2005)
-* Added framework support for processing incoming emails with an Action Mailer class.
+* Added framework support for processing incoming emails with an Action Mailer class. See example in README.
*0.7.1* (7th March, 2005)
View
@@ -1,4 +1,4 @@
-*SVN*
+*1.6.0* (22th March, 2005)
* Added a JavascriptHelper and accompanying prototype.js library that opens the world of Ajax to Action Pack with a large array of options for dynamically interacting with an application without reloading the page #884 [Sam Stephenson/David]
@@ -13,11 +13,11 @@
...
if @something.save
# will redirect, use flash
- flash['message'] = 'Save successful'
+ flash[:message] = 'Save successful'
redirect_to :action => 'list'
else
# no redirect, message is for current action, use flash.now
- flash.now['message'] = 'Save failed, review'
+ flash.now[:message] = 'Save failed, review'
render_action 'edit'
end
end
@@ -2,11 +2,16 @@
module ActionView
module Helpers
- # You must call <%= define_javascript_functions %> in your application,
- # or copy the included Javascript libraries into your application's
- # public/javascripts/ directory, before using these helpers.
- module JavascriptHelper
-
+ # Provides a set of helpers for calling Javascript functions and, most importantly, to call remote methods using what has
+ # been labelled Ajax[http://www.adaptivepath.com/publications/essays/archives/000385.php]. This means that you can call
+ # actions in your controllers without reloading the page, but still update certain parts of it using injections into the
+ # DOM. The common use case is having a form that adds a new element to a list without reloading the page.
+ #
+ # To be able to use the Javascript helpers, you must either call <%= define_javascript_functions %> (which returns all
+ # the Javascript support functions in a <script> block) or reference the Javascript library using
+ # <%= javascript_include_tag "prototype" %> (which looks for the library in /javascripts/prototype.js). The latter is
+ # recommended as the browser can then cache the library instead of fetching all the functions anew on every request.
+ module JavascriptHelper
unless const_defined? :CALLBACKS
CALLBACKS = [:uninitialized, :loading, :loaded, :interactive, :complete]
JAVASCRIPT_PATH = File.join(File.dirname(__FILE__), 'javascripts')
@@ -63,6 +68,10 @@ def link_to_remote(name, options = {}, html_options = {})
link_to_function(name, remote_function(options), html_options)
end
+ # Returns a form tag that will submit using XMLHttpRequest in the background instead of the regular
+ # reloading POST arrangement. Even though it's using Javascript to serialize the form elements, the form submission
+ # will work just like a regular submission as viewed by the receiving side (all elements available in @params).
+ # The options for specifying the target with :url and defining callbacks is the same as link_to_remote.
def form_remote_tag(options = {})
options[:form] = true
@@ -288,7 +288,7 @@ Form.Element.Serializers = {
select: function(element) {
var index = element.selectedIndex;
- return [element.name, element.options[index].value];
+ return [element.name, (index >= 0) ? element.options[index].value : ''];
}
}
@@ -1,4 +1,4 @@
-*0.6.1* (Unreleased)
+*0.6.1* (22th March, 2005)
* Fix that method response QNames mismatched with that declared in the WSDL, makes SOAP::WSDLDriverFactory work against AWS again
@@ -10,6 +10,7 @@
* Fix that SOAP fault response fault code values were not QName's #804
+
*0.6.0* (7th March, 2005)
* Add action_controller/test_invoke, used for integrating AWS with the Rails testing infrastructure
@@ -30,6 +31,7 @@
* Replace '::' with '..' in fully qualified type names for marshaling and WSDL. This improves interoperability with .NET, and closes #676.
+
*0.5.0* (24th February, 2005)
* lib/action_service/dispatcher*: replace "router" fragments with
@@ -288,7 +288,7 @@ Form.Element.Serializers = {
select: function(element) {
var index = element.selectedIndex;
- return [element.name, element.options[index].value];
+ return [element.name, (index >= 0) ? element.options[index].value : ''];
}
}

0 comments on commit 4e60fe3

Please sign in to comment.