From 5eee93864339b5055ee72155fd00adee7bbfafcd Mon Sep 17 00:00:00 2001 From: David Heinemeier Hansson Date: Tue, 5 Jul 2005 10:23:51 +0000 Subject: Added javascript_include_tag :defaults shortcut that'll include all the default javascripts included with Action Pack (prototype, effects, controls, dragdrop) git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1707 5ecf4fe2-1ee6-0310-87b1-e25e094e27de --- actionpack/lib/action_view/helpers/asset_tag_helper.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'actionpack/lib/action_view') 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 @@ module ActionView # 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)) -- cgit v1.2.3