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
This commit is contained in:
parent
e08025db6f
commit
5eee938643
@ -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]
|
||||
|
@ -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))
|
||||
|
Loading…
Reference in New Issue
Block a user