0
@@ -3,25 +3,25 @@ require 'set'
0
# Prototype[http://www.prototypejs.org/] is a JavaScript library that provides
0
- # DOM[http://en.wikipedia.org/wiki/Document_Object_Model] manipulation,
0
+ # DOM[http://en.wikipedia.org/wiki/Document_Object_Model] manipulation,
0
# Ajax[http://www.adaptivepath.com/publications/essays/archives/000385.php]
0
- # functionality, and more traditional object-oriented facilities for JavaScript.
0
+ # functionality, and more traditional object-oriented facilities for JavaScript.
0
# This module provides a set of helpers to make it more convenient to call
0
- # functions from Prototype using Rails, including functionality to call remote
0
- # Rails methods (that is, making a background request to a Rails action) using Ajax.
0
- # This means that you can call actions in your controllers without
0
- # reloading the page, but still update certain parts of it using
0
+ # functions from Prototype using Rails, including functionality to call remote
0
+ # Rails methods (that is, making a background request to a Rails action) using Ajax.
0
+ # This means that you can call actions in your controllers without
0
+ # reloading the page, but still update certain parts of it using
0
# injections into the DOM. A common use case is having a form that adds
0
# a new element to a list without reloading the page or updating a shopping
0
# cart total when a new item is added.
0
- # To be able to use these helpers, you must first include the Prototype
0
- # JavaScript framework in your pages.
0
+ # To be able to use these helpers, you must first include the Prototype
0
+ # JavaScript framework in your pages.
0
# javascript_include_tag 'prototype'
0
- # (See the documentation for
0
+ # (See the documentation for
0
# ActionView::Helpers::JavaScriptHelper for more information on including
0
# this and other JavaScript files in your Rails templates.)
0
@@ -29,7 +29,7 @@ module ActionView
0
# link_to_remote "Add to cart",
0
# :url => { :action => "add", :id => product.id },
0
- # :update => { :success => "cart", :failure => "error" }
0
+ # :update => { :success => "cart", :failure => "error" }
0
@@ -50,8 +50,8 @@ module ActionView
0
- # As you can see, there are numerous ways to use Prototype's Ajax functions (and actually more than
0
+ # As you can see, there are numerous ways to use Prototype's Ajax functions (and actually more than
0
# are listed here); check out the documentation for each method to find out more about its usage and options.
0
@@ -63,7 +63,7 @@ module ActionView
0
# When building your action handlers (that is, the Rails actions that receive your background requests), it's
0
# important to remember a few things. First, whatever your action would normall return to the browser, it will
0
# return to the Ajax call. As such, you typically don't want to render with a layout. This call will cause
0
- # the layout to be transmitted back to your page, and, if you have a full HTML/CSS, will likely mess a lot of things up.
0
+ # the layout to be transmitted back to your page, and, if you have a full HTML/CSS, will likely mess a lot of things up.
0
# You can turn the layout off on particular actions by doing the following:
0
# class SiteController < ActionController::Base
0
@@ -74,8 +74,8 @@ module ActionView
0
# render :layout => false
0
- # You can tell the type of request from within your action using the <tt>request.xhr?</tt> (XmlHttpRequest, the
0
- # method that Ajax uses to make background requests) method.
0
+ # You can tell the type of request from within your action using the <tt>request.xhr?</tt> (XmlHttpRequest, the
0
+ # method that Ajax uses to make background requests) method.
0
# # Is this an XmlHttpRequest request?
0
@@ -93,7 +93,7 @@ module ActionView
0
# Dropping this in your ApplicationController turns the layout off for every request that is an "xhr" request.
0
- # If you are just returning a little data or don't want to build a template for your output, you may opt to simply
0
+ # If you are just returning a little data or don't want to build a template for your output, you may opt to simply
0
# render text output, like this:
0
# render :text => 'Return this from my method!'
0
@@ -103,7 +103,7 @@ module ActionView
0
# == Updating multiple elements
0
# See JavaScriptGenerator for information on updating multiple elements
0
- # on the page in an Ajax response.
0
+ # on the page in an Ajax response.
0
unless const_defined? :CALLBACKS
0
CALLBACKS = Set.new([ :uninitialized, :loading, :loaded,
0
@@ -114,64 +114,64 @@ module ActionView
0
:form, :with, :update, :script ]).merge(CALLBACKS)
0
- # Returns a link to a remote action defined by <tt>options[:url]</tt>
0
- # (using the url_for format) that's called in the background using
0
+ # Returns a link to a remote action defined by <tt>options[:url]</tt>
0
+ # (using the url_for format) that's called in the background using
0
# XMLHttpRequest. The result of that request can then be inserted into a
0
- # DOM object whose id can be specified with <tt>options[:update]</tt>.
0
+ # DOM object whose id can be specified with <tt>options[:update]</tt>.
0
# Usually, the result would be a partial prepared by the controller with
0
- # # Generates: <a href="#" onclick="new Ajax.Updater('posts', '/blog/destroy/3', {asynchronous:true, evalScripts:true});
0
+ # # Generates: <a href="#" onclick="new Ajax.Updater('posts', '/blog/destroy/3', {asynchronous:true, evalScripts:true});
0
# # return false;">Delete this post</a>
0
- # link_to_remote "Delete this post", :update => "posts",
0
+ # link_to_remote "Delete this post", :update => "posts",
0
# :url => { :action => "destroy", :id => post.id }
0
- # # Generates: <a href="#" onclick="new Ajax.Updater('emails', '/mail/list_emails', {asynchronous:true, evalScripts:true});
0
+ # # Generates: <a href="#" onclick="new Ajax.Updater('emails', '/mail/list_emails', {asynchronous:true, evalScripts:true});
0
# # return false;"><img alt="Refresh" src="/images/refresh.png?" /></a>
0
- # link_to_remote(image_tag("refresh"), :update => "emails",
0
+ # link_to_remote(image_tag("refresh"), :update => "emails",
0
# :url => { :action => "list_emails" })
0
# You can override the generated HTML options by specifying a hash in
0
# <tt>options[:html]</tt>.
0
# link_to_remote "Delete this post", :update => "posts",
0
- # :url => post_url(@post), :method => :delete,
0
- # :html => { :class => "destructive" }
0
+ # :url => post_url(@post), :method => :delete,
0
+ # :html => { :class => "destructive" }
0
# You can also specify a hash for <tt>options[:update]</tt> to allow for
0
- # easy redirection of output to an other DOM element if a server-side
0
+ # easy redirection of output to an other DOM element if a server-side
0
- # # Generates: <a href="#" onclick="new Ajax.Updater({success:'posts',failure:'error'}, '/blog/destroy/5',
0
+ # # Generates: <a href="#" onclick="new Ajax.Updater({success:'posts',failure:'error'}, '/blog/destroy/5',
0
# # {asynchronous:true, evalScripts:true}); return false;">Delete this post</a>
0
# link_to_remote "Delete this post",
0
# :url => { :action => "destroy", :id => post.id },
0
# :update => { :success => "posts", :failure => "error" }
0
- # Optionally, you can use the <tt>options[:position]</tt> parameter to
0
- # influence how the target DOM element is updated. It must be one of
0
+ # Optionally, you can use the <tt>options[:position]</tt> parameter to
0
+ # influence how the target DOM element is updated. It must be one of
0
# <tt>:before</tt>, <tt>:top</tt>, <tt>:bottom</tt>, or <tt>:after</tt>.
0
# The method used is by default POST. You can also specify GET or you
0
# can simulate PUT or DELETE over POST. All specified with <tt>options[:method]</tt>
0
- # # Generates: <a href="#" onclick="new Ajax.Request('/person/4', {asynchronous:true, evalScripts:true, method:'delete'});
0
+ # # Generates: <a href="#" onclick="new Ajax.Request('/person/4', {asynchronous:true, evalScripts:true, method:'delete'});
0
# # return false;">Destroy</a>
0
# link_to_remote "Destroy", :url => person_url(:id => person), :method => :delete
0
- # By default, these remote requests are processed asynchronous during
0
- # which various JavaScript callbacks can be triggered (for progress
0
- # indicators and the likes). All callbacks get access to the
0
- # <tt>request</tt> object, which holds the underlying XMLHttpRequest.
0
+ # By default, these remote requests are processed asynchronous during
0
+ # which various JavaScript callbacks can be triggered (for progress
0
+ # indicators and the likes). All callbacks get access to the
0
+ # <tt>request</tt> object, which holds the underlying XMLHttpRequest.
0
# To access the server response, use <tt>request.responseText</tt>, to
0
# find out the HTTP status, use <tt>request.status</tt>.
0
- # # Generates: <a href="#" onclick="new Ajax.Request('/words/undo?n=33', {asynchronous:true, evalScripts:true,
0
+ # # Generates: <a href="#" onclick="new Ajax.Request('/words/undo?n=33', {asynchronous:true, evalScripts:true,
0
# # onComplete:function(request){undoRequestCompleted(request)}}); return false;">hello</a>
0
@@ -180,43 +180,43 @@ module ActionView
0
# The callbacks that may be specified are (in order):
0
- # <tt>:loading</tt>:: Called when the remote document is being
0
+ # <tt>:loading</tt>:: Called when the remote document is being