From 4e60fe3ef3474834a9880f3cdd2a47f8efa99bc5 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 22 Mar 2005 12:33:47 +0000 Subject: Added documentation and fixed an ajax bug git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@974 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 6 +++--- .../lib/action_view/helpers/javascript_helper.rb | 19 ++++++++++++++----- .../lib/action_view/helpers/javascripts/prototype.js | 2 +- 3 files changed, 18 insertions(+), 9 deletions(-) (limited to 'actionpack') diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 9c90b2830d..6978ddafb9 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -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 diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index 2e169b0f62..99b2fc1166 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -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