| Module | ActionView::Helpers::AssetTagHelper |
| In: |
vendor/actionpack/lib/action_view/helpers/asset_tag_helper.rb
|
Provides methods for linking a HTML page together with other assets, such as javascripts, stylesheets, and feeds.
Returns a link tag that browsers and news readers can use to auto-detect a RSS or ATOM feed for this page. The type can either be :rss (default) or :atom and the options follow the url_for style of declaring a link target.
Examples:
auto_discovery_link_tag # =>
<link rel="alternate" type="application/rss+xml" title="RSS" href="http://www.curenthost.com/controller/action" />
auto_discovery_link_tag(:atom) # =>
<link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.curenthost.com/controller/action" />
auto_discovery_link_tag(:rss, :action => "feed") # =>
<link rel="alternate" type="application/atom+xml" title="ATOM" href="http://www.curenthost.com/controller/feed" />
# File vendor/actionpack/lib/action_view/helpers/asset_tag_helper.rb, line 19
19: def auto_discovery_link_tag(type = :rss, options = {})
20: tag(
21: "link", "rel" => "alternate", "type" => "application/#{type}+xml", "title" => type.to_s.upcase,
22: "href" => url_for(options.merge(:only_path => false))
23: )
24: end
Returns a script include tag per source given as argument. Examples:
javascript_include_tag "xmlhr" # =>
<script language="JavaScript" type="text/javascript" src="/javascripts/xmlhr.js"></script>
javascript_include_tag "common.javascript", "/elsewhere/cools" # =>
<script language="JavaScript" type="text/javascript" src="/javascripts/common.javascript"></script>
<script language="JavaScript" type="text/javascript" src="/elsewhere/cools.js"></script>
# File vendor/actionpack/lib/action_view/helpers/asset_tag_helper.rb, line 34
34: def javascript_include_tag(*sources)
35: sources.collect { |source|
36: source = "/javascripts/#{source}" unless source.include?("/")
37: source = "#{source}.js" unless source.include?(".")
38: content_tag("script", "", "language" => "JavaScript", "type" => "text/javascript", "src" => source)
39: }.join("\n")
40: end
Returns a css link tag per source given as argument. Examples:
stylesheet_link_tag "style" # =>
<link href="/stylesheets/style.css" media="screen" 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" />
# File vendor/actionpack/lib/action_view/helpers/asset_tag_helper.rb, line 50
50: def stylesheet_link_tag(*sources)
51: sources.collect { |source|
52: source = "/stylesheets/#{source}" unless source.include?("/")
53: source = "#{source}.css" unless source.include?(".")
54: tag("link", "rel" => "Stylesheet", "type" => "text/css", "media" => "screen", "href" => source)
55: }.join("\n")
56: end