Added documentation and fixed an ajax bug

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
David Heinemeier Hansson
2005-03-22 12:33:47 +00:00
parent e1ce18020e
commit 4e60fe3ef3
6 changed files with 24 additions and 13 deletions

View File

@@ -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 File

@@ -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

View File

@@ -2,11 +2,16 @@ require File.dirname(__FILE__) + '/tag_helper'
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 @@ module ActionView
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

View File

@@ -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 : ''];
}
}

View File

@@ -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

View File

@@ -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 : ''];
}
}