From 6d88a992b5e92c09527c7915a7e2c8da09acb95e Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Sun, 3 Sep 2006 23:22:24 +0000 Subject: Added deprecation language for in_place_editor and auto_complete_field that both pieces will become plugins by Rails 2.0 [DHH] git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4952 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/CHANGELOG | 2 ++ actionpack/lib/action_controller/base.rb | 4 ++-- actionpack/lib/action_controller/flash.rb | 11 ++++++----- actionpack/lib/action_controller/helpers.rb | 1 - actionpack/lib/action_controller/integration.rb | 1 - actionpack/lib/action_controller/macros/auto_complete.rb | 2 ++ actionpack/lib/action_controller/macros/in_place_editing.rb | 2 ++ .../lib/action_view/helpers/java_script_macros_helper.rb | 10 ++++++++++ actionpack/test/template/java_script_macros_helper_test.rb | 1 + activesupport/lib/active_support/deprecation.rb | 4 ++-- 10 files changed, 27 insertions(+), 11 deletions(-) diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 9e2d105a2b..4f702d65db 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added deprecation language for in_place_editor and auto_complete_field that both pieces will become plugins by Rails 2.0 [DHH] + * Deprecated all of ActionController::Dependencies. All dependency loading is now handled from Active Support [DHH] * Added assert_select* for CSS selector-based testing (deprecates assert_tag) #5936 [assaf.arkin@gmail.com] diff --git a/actionpack/lib/action_controller/base.rb b/actionpack/lib/action_controller/base.rb index 7ab7845eea..ad165d5eb5 100755 --- a/actionpack/lib/action_controller/base.rb +++ b/actionpack/lib/action_controller/base.rb @@ -490,7 +490,7 @@ module ActionController #:nodoc: when Symbol ActiveSupport::Deprecation.warn( - "WARNING: You called url_for(:#{options}), which is a deprecated API call. Instead you should use the named " + + "You called url_for(:#{options}), which is a deprecated API call. Instead you should use the named " + "route directly, like #{options}(). Using symbols and parameters with url_for will be removed from Rails 2.0." ) @@ -680,7 +680,7 @@ module ActionController #:nodoc: options = { :update => true } else ActiveSupport::Deprecation.warn( - "WARNING: You called render('#{options}'), which is a deprecated API call. Instead you use " + + "You called render('#{options}'), which is a deprecated API call. Instead you use " + "render :file => #{options}. Calling render with just a string will be removed from Rails 2.0." ) diff --git a/actionpack/lib/action_controller/flash.rb b/actionpack/lib/action_controller/flash.rb index a166c1060c..6721a69d8c 100644 --- a/actionpack/lib/action_controller/flash.rb +++ b/actionpack/lib/action_controller/flash.rb @@ -29,8 +29,8 @@ module ActionController #:nodoc: base.class_eval do alias_method_chain :assign_shortcuts, :flash - alias_method_chain :process_cleanup, :flash - alias_method_chain :reset_session, :flash + alias_method_chain :process_cleanup, :flash + alias_method_chain :reset_session, :flash end end @@ -92,7 +92,7 @@ module ActionController #:nodoc: # # flash.keep # keeps the entire flash # flash.keep(:notice) # keeps only the "notice" entry, the rest of the flash is discarded - def keep(k=nil) + def keep(k = nil) use(k, false) end @@ -100,7 +100,7 @@ module ActionController #:nodoc: # # flash.keep # keep entire flash available for the next action # flash.discard(:warning) # discard the "warning" entry (it'll still be available for the current action) - def discard(k=nil) + def discard(k = nil) use(k) end @@ -116,6 +116,7 @@ module ActionController #:nodoc: @used.delete(k) end end + (@used.keys - keys).each{|k| @used.delete k } # clean up after keys that could have been left over by calling reject! or shift on the flash end @@ -173,7 +174,7 @@ module ActionController #:nodoc: # deprecated. use flash.keep instead def keep_flash #:doc: - warn 'keep_flash is deprecated; use flash.keep instead.' + ActiveSupport::Deprecation.warn 'keep_flash is deprecated; use flash.keep instead.' flash.keep end end diff --git a/actionpack/lib/action_controller/helpers.rb b/actionpack/lib/action_controller/helpers.rb index 8aeef52868..dfc77851fc 100644 --- a/actionpack/lib/action_controller/helpers.rb +++ b/actionpack/lib/action_controller/helpers.rb @@ -1,7 +1,6 @@ module ActionController #:nodoc: module Helpers #:nodoc: def self.included(base) - # Initialize the base module to aggregate its helpers. base.class_inheritable_accessor :master_helper_module base.master_helper_module = Module.new diff --git a/actionpack/lib/action_controller/integration.rb b/actionpack/lib/action_controller/integration.rb index 545a39ac9a..7676d15c2d 100644 --- a/actionpack/lib/action_controller/integration.rb +++ b/actionpack/lib/action_controller/integration.rb @@ -182,7 +182,6 @@ module ActionController end private - class MockCGI < CGI #:nodoc: attr_accessor :stdinput, :stdoutput, :env_table diff --git a/actionpack/lib/action_controller/macros/auto_complete.rb b/actionpack/lib/action_controller/macros/auto_complete.rb index c320ae79e1..8282e2c10c 100644 --- a/actionpack/lib/action_controller/macros/auto_complete.rb +++ b/actionpack/lib/action_controller/macros/auto_complete.rb @@ -8,6 +8,8 @@ module ActionController base.extend(ClassMethods) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Example: # # # Controller diff --git a/actionpack/lib/action_controller/macros/in_place_editing.rb b/actionpack/lib/action_controller/macros/in_place_editing.rb index 40b083e3fc..d04f1ce1de 100644 --- a/actionpack/lib/action_controller/macros/in_place_editing.rb +++ b/actionpack/lib/action_controller/macros/in_place_editing.rb @@ -5,6 +5,8 @@ module ActionController base.extend(ClassMethods) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Example: # # # Controller diff --git a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb index f7523b843f..8ce2940aeb 100644 --- a/actionpack/lib/action_view/helpers/java_script_macros_helper.rb +++ b/actionpack/lib/action_view/helpers/java_script_macros_helper.rb @@ -7,6 +7,8 @@ module ActionView # editing relies on ActionController::Base.in_place_edit_for and the autocompletion relies on # ActionController::Base.auto_complete_for. module JavaScriptMacrosHelper + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Makes an HTML element specified by the DOM ID +field_id+ become an in-place # editor of a property. # @@ -64,6 +66,8 @@ module ActionView javascript_tag(function) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Renders the value of the specified object and method with in-place editing capabilities. # # See the RDoc on ActionController::InPlaceEditing to learn more about this. @@ -75,6 +79,8 @@ module ActionView in_place_editor(tag_options[:id], in_place_editor_options) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Adds AJAX autocomplete functionality to the text input field with the # DOM ID specified by +field_id+. # @@ -153,6 +159,8 @@ module ActionView javascript_tag(function) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Use this method in your view to generate a return for the AJAX autocomplete requests. # # Example action: @@ -172,6 +180,8 @@ module ActionView content_tag("ul", items.uniq) end + # DEPRECATION WARNING: This method will become a separate plugin when Rails 2.0 ships. + # # Wrapper for text_field with added AJAX autocompletion functionality. # # In your controller, you'll need to define an action called diff --git a/actionpack/test/template/java_script_macros_helper_test.rb b/actionpack/test/template/java_script_macros_helper_test.rb index 7d2d8eb68f..ac629b97da 100644 --- a/actionpack/test/template/java_script_macros_helper_test.rb +++ b/actionpack/test/template/java_script_macros_helper_test.rb @@ -57,6 +57,7 @@ class JavaScriptMacrosHelperTest < Test::Unit::TestCase def test_text_field_with_auto_complete assert_match %(