From 7da736f929e88f4730f160d28afc90667c26b966 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Jun 2005 12:03:43 +0000 Subject: [PATCH] Added script.aculo.us Javascripts (controls.js, dragdrop.js, effects.js) (NEEDS MORE DESCRIPTION) #1509 [Thomas Fuchs] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1522 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 + .../action_view/helpers/javascript_helper.rb | 123 +++- .../helpers/javascripts/controls.js | 218 +++++++ .../helpers/javascripts/dragdrop.js | 385 ++++++++++++ .../helpers/javascripts/effects.js | 557 ++++++++++++++++++ .../helpers/javascripts/prototype.js | 438 ++++++++------ actionpack/test/template/javascript_helper.rb | 24 +- 7 files changed, 1558 insertions(+), 189 deletions(-) create mode 100644 actionpack/lib/action_view/helpers/javascripts/controls.js create mode 100644 actionpack/lib/action_view/helpers/javascripts/dragdrop.js create mode 100644 actionpack/lib/action_view/helpers/javascripts/effects.js diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index c3a922604e..ae8de12988 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added script.aculo.us Javascripts (controls.js, dragdrop.js, effects.js) (NEEDS MORE DESCRIPTION) #1509 [Thomas Fuchs] + * Fixed prototype to consider all fields it doesn't know as text (such as Safari's search) just like the browser in its serialization #1497 [Sean Treadway] * Improved performance of Routes generation by a factor of 5 #1434 [Nicholas Seckar] diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb index d5e2a8b2dc..31c15d222c 100644 --- a/actionpack/lib/action_view/helpers/javascript_helper.rb +++ b/actionpack/lib/action_view/helpers/javascript_helper.rb @@ -16,7 +16,8 @@ module Helpers # the use of form_remote_tag. module JavascriptHelper unless const_defined? :CALLBACKS - CALLBACKS = [:uninitialized, :loading, :loaded, :interactive, :complete] + CALLBACKS = [ :uninitialized, :loading, :loaded, :interactive, :complete ] + AJAX_OPTIONS = [ :url, :asynchronous, :method, :insertion, :form, :with ].concat(CALLBACKS) JAVASCRIPT_PATH = File.join(File.dirname(__FILE__), 'javascripts') end @@ -146,8 +147,10 @@ def remote_function(options) #:nodoc: for now return function end - # Includes the Action Pack Javascript library inside a single ' end # Observes the field with the DOM ID specified by +field_id+ and makes - # an Ajax when its contents have changed. + # an Ajax call when its contents have changed. # # Required +options+ are: # :frequency:: The frequency (in seconds) at which changes to @@ -190,13 +203,111 @@ def observe_field(field_id, options = {}) def observe_form(form_id, options = {}) build_observer('Form.Observer', form_id, options) end + + + # Adds Ajax autocomplete functionality to the text input field with the + # DOM ID specified by +field_id+. + # + # This function expects that the called action returns a HTML