aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/asset_tag_helper.rb
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2005-05-03 14:39:57 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2005-05-03 14:39:57 +0000
commitdacb61c8ca37154e9a813abc964df7f7973cea97 (patch)
treedf0e2277c1e7a6633e3534e90ee0bb00a5ca36e9 /actionpack/lib/action_view/helpers/asset_tag_helper.rb
parentd2fb072563ff54109ecfec0119a192c8a9071889 (diff)
downloadrails-dacb61c8ca37154e9a813abc964df7f7973cea97.tar.gz
rails-dacb61c8ca37154e9a813abc964df7f7973cea97.tar.bz2
rails-dacb61c8ca37154e9a813abc964df7f7973cea97.zip
Added that both AssetHelper#stylesheet_link_tag and AssetHelper#javascript_include_tag now accept an option hash as the last parameter, so you can do stuff like: stylesheet_link_tag "style", :media => "all"
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1281 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib/action_view/helpers/asset_tag_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index a1c22747ae..665674972d 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -39,9 +39,10 @@ module ActionView
# <script type="text/javascript" src="/javascripts/common.javascript"></script>
# <script type="text/javascript" src="/elsewhere/cools.js"></script>
def javascript_include_tag(*sources)
+ options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
sources.collect { |source|
source = javascript_path(source)
- content_tag("script", "", "type" => "text/javascript", "src" => source)
+ content_tag("script", "", { "type" => "text/javascript", "src" => source }.merge(options))
}.join("\n")
end
@@ -57,13 +58,17 @@ module ActionView
# stylesheet_link_tag "style" # =>
# <link href="/stylesheets/style.css" media="screen" rel="Stylesheet" type="text/css" />
#
+ # stylesheet_link_tag "style", :media => "all" # =>
+ # <link href="/stylesheets/style.css" media="all" rel="Stylesheet" type="text/css" />
+ #
# stylesheet_link_tag "random.styles", "/css/stylish" # =>
# <link href="/stylesheets/random.styles" media="screen" rel="Stylesheet" type="text/css" />
# <link href="/css/stylish.css" media="screen" rel="Stylesheet" type="text/css" />
def stylesheet_link_tag(*sources)
+ options = sources.last.is_a?(Hash) ? sources.pop.stringify_keys : { }
sources.collect { |source|
source = stylesheet_path(source)
- tag("link", "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => source)
+ tag("link", { "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => source }.merge(options))
}.join("\n")
end