From 7da736f929e88f4730f160d28afc90667c26b966 Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 26 Jun 2005 12:03:43 +0000 Subject: 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 --- .../lib/action_view/helpers/javascript_helper.rb | 123 ++++- .../action_view/helpers/javascripts/controls.js | 218 ++++++++ .../action_view/helpers/javascripts/dragdrop.js | 385 ++++++++++++++ .../lib/action_view/helpers/javascripts/effects.js | 557 +++++++++++++++++++++ .../action_view/helpers/javascripts/prototype.js | 438 +++++++++------- 5 files changed, 1533 insertions(+), 188 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 (limited to 'actionpack/lib/action_view') 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 ActionView # 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 @@ module ActionView 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 @@ module ActionView 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