Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Added javascript_include_tag :defaults shortcut that'll include all t…

…he 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
  • Loading branch information...
commit 5eee93864339b5055ee72155fd00adee7bbfafcd 1 parent e08025d
@dhh dhh authored
View
2  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]
View
7 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -43,8 +43,15 @@ def javascript_path(source)
# javascript_include_tag "common.javascript", "/elsewhere/cools" # =>
# <script type="text/javascript" src="/javascripts/common.javascript"></script>
# <script type="text/javascript" src="/elsewhere/cools.js"></script>
+ #
+ # javascript_include_tag :defaults # =>
+ # <script type="text/javascript" src="/javascripts/prototype.js"></script>
+ # <script type="text/javascript" src="/javascripts/effects.js"></script>
+ # <script type="text/javascript" src="/javascripts/controls.js"></script>
+ # <script type="text/javascript" src="/javascripts/dragdrop.js"></script>
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))
Please sign in to comment.
Something went wrong with that request. Please try again.