From bcd3b870cea567ffc626144a0292fba7797a4c78 Mon Sep 17 00:00:00 2001 From: Prem Sichanugrist Date: Fri, 3 Feb 2012 18:10:37 -0500 Subject: Add *_url helpers to get the full assets URL Adds `image_url`, `javascript_url`, `stylesheet_url`, `audio_url`, `video_url`, and `font_url` to assets tag helper. These URL helpers will return the full path to your assets. This is useful when you are going to reference this asset from external host. --- .../guides/source/action_view_overview.textile | 24 ++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'railties') diff --git a/railties/guides/source/action_view_overview.textile b/railties/guides/source/action_view_overview.textile index ac5c9fa4d8..3b0fbfb464 100644 --- a/railties/guides/source/action_view_overview.textile +++ b/railties/guides/source/action_view_overview.textile @@ -585,6 +585,14 @@ Computes the path to an image asset in the +public/images+ directory. Full paths image_path("edit.png") # => /images/edit.png +h5. image_url + +Computes the url to an image asset in the +public/images+ directory. This will call +image_path+ internally and merge with your current host or your asset host. + + +image_url("edit.png") # => http://www.example.com/images/edit.png + + h5. image_tag Returns an html image tag for the source. The source can be a full path or a file that exists in your +public/images+ directory. @@ -629,6 +637,14 @@ Computes the path to a JavaScript asset in the +public/javascripts+ directory. I javascript_path "common" # => /javascripts/common.js +h5. javascript_url + +Computes the url to a JavaScript asset in the +public/javascripts+ directory. This will call +javascript_path+ internally and merge with your current host or your asset host. + + +javascript_url "common" # => http://www.example.com/javascripts/common.js + + h5. stylesheet_link_tag Returns a stylesheet link tag for the sources specified as arguments. If you don't specify an extension, +.css+ will be appended automatically. @@ -659,6 +675,14 @@ Computes the path to a stylesheet asset in the +public/stylesheets+ directory. I stylesheet_path "application" # => /stylesheets/application.css +h5. stylesheet_url + +Computes the url to a stylesheet asset in the +public/stylesheets+ directory. This will call +stylesheet_path+ internally and merge with your current host or your asset host. + + +stylesheet_url "application" # => http://www.example.com/stylesheets/application.css + + h4. AtomFeedHelper h5. atom_feed -- cgit v1.2.3