aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2008-06-30 18:46:53 +0300
committerMichael Koziarski <michael@koziarski.com>2008-07-03 19:21:04 +0300
commite358b1fce8fdcbac896dde08286be020420e843e (patch)
tree0bc8c93d7503e3e93d8c979d5b4b4fe70ce9617e /actionpack
parent5501166dec84e1dd63800ea25eaf23290216cf80 (diff)
downloadrails-e358b1fce8fdcbac896dde08286be020420e843e.tar.gz
rails-e358b1fce8fdcbac896dde08286be020420e843e.tar.bz2
rails-e358b1fce8fdcbac896dde08286be020420e843e.zip
Remove old method of including javascripts define_javascript_functions.
javascript_include_tag and friends do a much better job.
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/helpers/javascript_helper.rb26
-rw-r--r--actionpack/test/template/javascript_helper_test.rb8
3 files changed, 2 insertions, 34 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index 9d64b6f231..0a5afddf04 100644
--- a/actionpack/CHANGELOG
+++ b/actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*Edge*
+* Remove define_javascript_functions, javascript_include_tag and friends are far superior. [Michael Koziarski]
+
* Deprecate :use_full_path render option. The supplying the option no longer has an effect [Josh Peek]
* Add :as option to render a collection of partials with a custom local variable name. #509 [Simon Jefford, Pratik Naik]
diff --git a/actionpack/lib/action_view/helpers/javascript_helper.rb b/actionpack/lib/action_view/helpers/javascript_helper.rb
index 8caca5b23f..22bd5cb440 100644
--- a/actionpack/lib/action_view/helpers/javascript_helper.rb
+++ b/actionpack/lib/action_view/helpers/javascript_helper.rb
@@ -114,32 +114,6 @@ module ActionView
tag(:input, html_options.merge(:type => 'button', :value => name, :onclick => onclick))
end
- # Includes the Action Pack JavaScript libraries inside a single <script>
- # tag. The function first includes prototype.js and then its core extensions,
- # (determined by filenames starting with "prototype").
- # Afterwards, any additional scripts will be included in undefined order.
- #
- # Note: The recommended approach is to copy the contents of
- # lib/action_view/helpers/javascripts/ into your application's
- # public/javascripts/ directory, and use +javascript_include_tag+ to
- # create remote <script> links.
- def define_javascript_functions
- javascript = "<script type=\"#{Mime::JS}\">"
-
- # load prototype.js and its extensions first
- prototype_libs = Dir.glob(File.join(JAVASCRIPT_PATH, 'prototype*')).sort.reverse
- prototype_libs.each do |filename|
- javascript << "\n" << IO.read(filename)
- end
-
- # load other libraries
- (Dir.glob(File.join(JAVASCRIPT_PATH, '*')) - prototype_libs).each do |filename|
- javascript << "\n" << IO.read(filename)
- end
- javascript << '</script>'
- end
-
-
JS_ESCAPE_MAP = {
'\\' => '\\\\',
'</' => '<\/',
diff --git a/actionpack/test/template/javascript_helper_test.rb b/actionpack/test/template/javascript_helper_test.rb
index d6d398d224..b2c4a130c8 100644
--- a/actionpack/test/template/javascript_helper_test.rb
+++ b/actionpack/test/template/javascript_helper_test.rb
@@ -3,14 +3,6 @@ require 'abstract_unit'
class JavaScriptHelperTest < ActionView::TestCase
tests ActionView::Helpers::JavaScriptHelper
- def test_define_javascript_functions
- # check if prototype.js is included first
- assert_not_nil define_javascript_functions.split("\n")[1].match(/Prototype JavaScript framework/)
-
- # check that scriptaculous.js is not in here, only needed if loaded remotely
- assert_nil define_javascript_functions.split("\n")[1].match(/var Scriptaculous = \{/)
- end
-
def test_escape_javascript
assert_equal '', escape_javascript(nil)
assert_equal %(This \\"thing\\" is really\\n netos\\'), escape_javascript(%(This "thing" is really\n netos'))