aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-02-28 05:16:34 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-02-28 05:16:34 +0000
commitfed41fbe8b79725904437230ac9e7abfb53df651 (patch)
tree5d1ddfda07b1e03e2b8b667e48611569e1723c90 /actionpack/lib/action_view
parentb56cac56dd0e8c38a5725490a86f05cb77aee6ca (diff)
downloadrails-fed41fbe8b79725904437230ac9e7abfb53df651.tar.gz
rails-fed41fbe8b79725904437230ac9e7abfb53df651.tar.bz2
rails-fed41fbe8b79725904437230ac9e7abfb53df651.zip
Added support to AssetTagHelper#javascript_include_tag for having :defaults appear anywhere in the list, so you can now make one call ala javascript_include_tag(:defaults, "my_scripts") or javascript_include_tag("my_scripts", :defaults) depending on how you want the load order (closes #3506) [Bob Silva]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3696 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb9
1 files changed, 4 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 0b725ce508..a5687923b2 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -59,11 +59,10 @@ module ActionView
# <tt>controllers/application.rb</tt> and <tt>helpers/application_helper.rb</tt>.
def javascript_include_tag(*sources)
options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
- if sources.first == :defaults
- sources = @@javascript_default_sources.dup
- if defined?(RAILS_ROOT) and File.exists?("#{RAILS_ROOT}/public/javascripts/application.js")
- sources << 'application'
- end
+ if sources.include?(:defaults)
+ sources = sources[0..(sources.index(:defaults))] + @@javascript_default_sources.dup + sources[(sources.index(:defaults) + 1)..sources.length]
+ sources.delete(:defaults)
+ sources << "application" if defined?(RAILS_ROOT) and File.exists?("#{RAILS_ROOT}/public/javascripts/application.js")
end
sources.collect { |source|
source = javascript_path(source)