Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

All asset url helpers should pass options

  • Loading branch information...
commit aa493f04d35c2aa3207db0ee6f5568b09ea764a9 1 parent dee3a19
@josh josh authored
Showing with 24 additions and 24 deletions.
  1. +24 −24 actionpack/lib/action_view/helpers/asset_url_helper.rb
View
48 actionpack/lib/action_view/helpers/asset_url_helper.rb
@@ -218,15 +218,15 @@ def compute_asset_host(source = "", options = {})
# javascript_path "/dir/xmlhr" # => /dir/xmlhr.js
# javascript_path "http://www.example.com/js/xmlhr" # => http://www.example.com/js/xmlhr
# javascript_path "http://www.example.com/js/xmlhr.js" # => http://www.example.com/js/xmlhr.js
- def javascript_path(source)
- path_to_asset(source, type: :javascript)
+ def javascript_path(source, options = {})
+ path_to_asset(source, {type: :javascript}.merge(options))
end
alias_method :path_to_javascript, :javascript_path # aliased to avoid conflicts with a javascript_path named route
# Computes the full URL to a javascript asset in the public javascripts directory.
# This will use +javascript_path+ internally, so most of their behaviors will be the same.
- def javascript_url(source)
- url_to_asset(source, type: :javascript)
+ def javascript_url(source, options = {})
+ url_to_asset(source, {type: :javascript}.merge(options))
end
alias_method :url_to_javascript, :javascript_url # aliased to avoid conflicts with a javascript_url named route
@@ -240,15 +240,15 @@ def javascript_url(source)
# stylesheet_path "/dir/style.css" # => /dir/style.css
# stylesheet_path "http://www.example.com/css/style" # => http://www.example.com/css/style
# stylesheet_path "http://www.example.com/css/style.css" # => http://www.example.com/css/style.css
- def stylesheet_path(source)
- path_to_asset(source, type: :stylesheet)
+ def stylesheet_path(source, options = {})
+ path_to_asset(source, {type: :stylesheet}.merge(options))
end
alias_method :path_to_stylesheet, :stylesheet_path # aliased to avoid conflicts with a stylesheet_path named route
# Computes the full URL to a stylesheet asset in the public stylesheets directory.
# This will use +stylesheet_path+ internally, so most of their behaviors will be the same.
- def stylesheet_url(source)
- url_to_asset(source, type: :stylesheet)
+ def stylesheet_url(source, options = {})
+ url_to_asset(source, {type: :stylesheet}.merge(options))
end
alias_method :url_to_stylesheet, :stylesheet_url # aliased to avoid conflicts with a stylesheet_url named route
@@ -265,15 +265,15 @@ def stylesheet_url(source)
# If you have images as application resources this method may conflict with their named routes.
# The alias +path_to_image+ is provided to avoid that. Rails uses the alias internally, and
# plugin authors are encouraged to do so.
- def image_path(source)
- path_to_asset(source, type: :image)
+ def image_path(source, options = {})
+ path_to_asset(source, {type: :image}.merge(options))
end
alias_method :path_to_image, :image_path # aliased to avoid conflicts with an image_path named route
# Computes the full URL to an image asset.
# This will use +image_path+ internally, so most of their behaviors will be the same.
- def image_url(source)
- url_to_asset(source, type: :image)
+ def image_url(source, options = {})
+ url_to_asset(source, {type: :image}.merge(options))
end
alias_method :url_to_image, :image_url # aliased to avoid conflicts with an image_url named route
@@ -286,15 +286,15 @@ def image_url(source)
# video_path("trailers/hd.avi") # => /videos/trailers/hd.avi
# video_path("/trailers/hd.avi") # => /trailers/hd.avi
# video_path("http://www.example.com/vid/hd.avi") # => http://www.example.com/vid/hd.avi
- def video_path(source)
- path_to_asset(source, type: :video)
+ def video_path(source, options = {})
+ path_to_asset(source, {type: :video}.merge(options))
end
alias_method :path_to_video, :video_path # aliased to avoid conflicts with a video_path named route
# Computes the full URL to a video asset in the public videos directory.
# This will use +video_path+ internally, so most of their behaviors will be the same.
- def video_url(source)
- url_to_asset(source, type: :video)
+ def video_url(source, options = {})
+ url_to_asset(source, {type: :video}.merge(options))
end
alias_method :url_to_video, :video_url # aliased to avoid conflicts with an video_url named route
@@ -307,15 +307,15 @@ def video_url(source)
# audio_path("sounds/horse.wav") # => /audios/sounds/horse.wav
# audio_path("/sounds/horse.wav") # => /sounds/horse.wav
# audio_path("http://www.example.com/sounds/horse.wav") # => http://www.example.com/sounds/horse.wav
- def audio_path(source)
- path_to_asset(source, type: :audio)
+ def audio_path(source, options = {})
+ path_to_asset(source, {type: :audio}.merge(options))
end
alias_method :path_to_audio, :audio_path # aliased to avoid conflicts with an audio_path named route
# Computes the full URL to an audio asset in the public audios directory.
# This will use +audio_path+ internally, so most of their behaviors will be the same.
- def audio_url(source)
- url_to_asset(source, type: :audio)
+ def audio_url(source, options = {})
+ url_to_asset(source, {type: :audio}.merge(options))
end
alias_method :url_to_audio, :audio_url # aliased to avoid conflicts with an audio_url named route
@@ -327,15 +327,15 @@ def audio_url(source)
# font_path("dir/font.ttf") # => /assets/dir/font.ttf
# font_path("/dir/font.ttf") # => /dir/font.ttf
# font_path("http://www.example.com/dir/font.ttf") # => http://www.example.com/dir/font.ttf
- def font_path(source)
- path_to_asset(source, type: :font)
+ def font_path(source, options = {})
+ path_to_asset(source, {type: :font}.merge(options))
end
alias_method :path_to_font, :font_path # aliased to avoid conflicts with an font_path named route
# Computes the full URL to a font asset.
# This will use +font_path+ internally, so most of their behaviors will be the same.
- def font_url(source)
- url_to_asset(source, type: :font)
+ def font_url(source, options = {})
+ url_to_asset(source, {type: :font}.merge(options))
end
alias_method :url_to_font, :font_url # aliased to avoid conflicts with an font_url named route
Please sign in to comment.
Something went wrong with that request. Please try again.