diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG index 6a13be1174..0dd82275f0 100644 --- a/actionpack/CHANGELOG +++ b/actionpack/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Added javascript_include_tag :defaults shortcut that'll include all the default javascripts included with Action Pack (prototype, effects, controls, dragdrop) + * Cache several controller variables that are expensive to calculate #1229 [skaes@web.de] * The session class backing CGI::Session::ActiveRecordStore may be replaced with any class that duck-types with a subset of Active Record. See docs for details #1238 [skaes@web.de] diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 9970244fb0..cd56592300 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -43,8 +43,15 @@ def javascript_path(source) # javascript_include_tag "common.javascript", "/elsewhere/cools" # => # # + # + # javascript_include_tag :defaults # => + # + # + # + # def javascript_include_tag(*sources) options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { } + sources = ['prototype', 'effects', 'controls', 'dragdrop'] if sources.first == :defaults sources.collect { |source| source = javascript_path(source) content_tag("script", "", { "type" => "text/javascript", "src" => source }.merge(options))