提交 a22164a2 编写于 作者: S schneems

Fix formatting

上级 9b22681c
......@@ -186,17 +186,17 @@ def auto_discovery_link_tag(type = :rss, url_options = {}, tag_options = {})
# favicon_link_tag 'mb-icon.png', rel: 'apple-touch-icon', type: 'image/png'
# # => <link href="/assets/mb-icon.png" rel="apple-touch-icon" type="image/png" />
def favicon_link_tag(source="favicon.ico", options={})
tag('link', {
tag("link", {
rel: "shortcut icon",
type: "image/x-icon",
href: path_to_image(source, { public_folder: options.delete(:public_folder) })
href: path_to_image(source, public_folder: options.delete(:public_folder))
}.merge!(options.symbolize_keys))
end
# Returns a link tag for a favicon asset in the public
# folder. This uses +favicon_link_tag+ and skips any asset
# lookups by assuming any assets are in the `public` folder.
def public_favicon_link_tag(source='favicon.ico', options={})
def public_favicon_link_tag(source="favicon.ico", options={})
favicon_link_tag(source, { public_folder: true }.merge!(options))
end
......@@ -234,7 +234,7 @@ def image_tag(source, options={})
options = options.symbolize_keys
check_for_image_tag_errors(options)
src = options[:src] = path_to_image(source, { public_folder: options.delete(:public_folder) })
src = options[:src] = path_to_image(source, public_folder: options.delete(:public_folder))
unless src.start_with?("cid:") || src.start_with?("data:") || src.blank?
options[:alt] = options.fetch(:alt) { image_alt(src) }
......@@ -315,7 +315,7 @@ def video_tag(*sources)
public_poster_folder = options.delete(:public_poster_folder)
sources << options
multiple_sources_tag("video", sources) do |options|
options[:poster] = path_to_image(options[:poster], { public_folder: public_poster_folder }) if options[:poster]
options[:poster] = path_to_image(options[:poster], public_folder: public_poster_folder) if options[:poster]
options[:width], options[:height] = extract_dimensions(options.delete(:size)) if options[:size]
end
end
......@@ -325,7 +325,7 @@ def video_tag(*sources)
# lookups by assuming any assets are in the `public` folder.
def public_video_tag(*sources)
options = sources.extract_options!
video_tag(*sources, { public_folder: true , public_poster_folder: true}.merge!(options))
video_tag(*sources, { public_folder: true , public_poster_folder: true }.merge!(options))
end
# Returns an HTML audio tag for the +source+.
......@@ -361,10 +361,10 @@ def multiple_sources_tag(type, sources)
if sources.size > 1
content_tag(type, options) do
safe_join sources.map { |source| tag("source", src: send("path_to_#{type}", source, { public_folder: public_folder })) }
safe_join sources.map { |source| tag("source", src: send("path_to_#{type}", source, public_folder: public_folder)) }
end
else
options[:src] = send("path_to_#{type}", sources.first, { public_folder: public_folder })
options[:src] = send("path_to_#{type}", sources.first, public_folder: public_folder)
content_tag(type, nil, options)
end
end
......
......@@ -167,12 +167,11 @@ def asset_path(source, options = {})
end
alias_method :path_to_asset, :asset_path # aliased to avoid conflicts with an asset_path named route
# Computes the path to an asset in the public folder.
# This uses +asset_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_asset_path(source, options = {})
path_to_asset(source, {public_folder: true}.merge!(options))
path_to_asset(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with an public_asset_path named route
......@@ -195,7 +194,7 @@ def asset_url(source, options = {})
# This uses +asset_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_asset_url(source, options = {})
url_to_asset(source, {public_folder: true}.merge!(options))
url_to_asset(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_asset, :public_asset_path # aliased to avoid conflicts with a public_asset_path named route
......@@ -289,7 +288,7 @@ def javascript_path(source, options = {})
# This uses +javascript_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_javascript_path(source, options = {})
path_to_javascript(source, {public_folder: true}.merge!(options))
path_to_javascript(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with a public_javascript_path named route
......@@ -309,7 +308,7 @@ def javascript_url(source, options = {})
# This uses +javascript_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_javascript_url(source, options = {})
url_to_javascript(source, {public_folder: true}.merge!(options))
url_to_javascript(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_javascript, :public_javascript_path # aliased to avoid conflicts with a public_javascript_path named route
......@@ -332,7 +331,7 @@ def stylesheet_path(source, options = {})
# This uses +stylesheet_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_stylesheet_path(source, options = {})
path_to_stylesheet(source, {public_folder: true}.merge!(options))
path_to_stylesheet(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with a public_stylesheet_path named route
......@@ -352,7 +351,7 @@ def stylesheet_url(source, options = {})
# This uses +stylesheet_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_stylesheet_url(source, options = {})
url_to_stylesheet(source, {public_folder: true}.merge!(options))
url_to_stylesheet(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_stylesheet, :public_stylesheet_path # aliased to avoid conflicts with a public_stylesheet_path named route
......@@ -378,7 +377,7 @@ def image_path(source, options = {})
# This uses +image_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_image_path(source, options = {})
path_to_image(source, {public_folder: true}.merge!(options))
path_to_image(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with a public_image_path named route
......@@ -398,7 +397,7 @@ def image_url(source, options = {})
# This uses +image_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_image_url(source, options = {})
url_to_image(source, {public_folder: true}.merge!(options))
url_to_image(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_image, :public_image_path # aliased to avoid conflicts with a public_image_path named route
......@@ -420,7 +419,7 @@ def video_path(source, options = {})
# This uses +video_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_video_path(source, options = {})
path_to_video(source, {public_folder: true}.merge!(options))
path_to_video(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with a public_video_path named route
......@@ -440,7 +439,7 @@ def video_url(source, options = {})
# This uses +video_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_video_url(source, options = {})
url_to_video(source, {public_folder: true}.merge!(options))
url_to_video(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_video, :public_video_path # aliased to avoid conflicts with a public_video_path named route
......@@ -462,7 +461,7 @@ def audio_path(source, options = {})
# This uses +audio_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_audio_path(source, options = {})
path_to_audio(source, {public_folder: true}.merge!(options))
path_to_audio(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with a public_audio_path named route
......@@ -482,7 +481,7 @@ def audio_url(source, options = {})
# This uses +audio_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_audio_url(source, options = {})
url_to_audio(source, {public_folder: true}.merge!(options))
url_to_audio(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_audio, :public_audio_path # aliased to avoid conflicts with a public_audio_path named route
......@@ -503,7 +502,7 @@ def font_path(source, options = {})
# This uses +font_path+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_font_path(source, options = {})
path_to_font(source, {public_folder: true}.merge!(options))
path_to_font(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with a public_font_path named route
......@@ -523,7 +522,7 @@ def font_url(source, options = {})
# This uses +font_url+ and skips any asset lookups by assuming the asset is in the
# `public` folder.
def public_font_url(source, options = {})
url_to_font(source, {public_folder: true}.merge!(options))
url_to_font(source, { public_folder: true }.merge!(options))
end
alias_method :path_to_public_font, :public_font_path # aliased to avoid conflicts with a public_font_url named route
end
......
......@@ -94,7 +94,7 @@ class ::PostsController < ActionController::Base ; end
class ::PostsController < ActionController::Base ; end
get '/posts?debug_assets=true'
get "/posts?debug_assets=true"
body = last_response.body
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{ tag_match }, but did not: #{ body }")
......@@ -120,7 +120,7 @@ class ::PostsController < ActionController::Base ; end
class ::PostsController < ActionController::Base ; end
get '/posts?debug_assets=true'
get "/posts?debug_assets=true"
body = last_response.body
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{ tag_match }, but did not: #{ body }")
......@@ -140,7 +140,7 @@ class ::PostsController < ActionController::Base ; end
class ::PostsController < ActionController::Base ; end
get '/posts?debug_assets=true'
get "/posts?debug_assets=true"
body = last_response.body.strip
assert_match(tag_match, body, "Expected `#{view_method}` to produce a match to #{ tag_match }, but did not: #{ body }")
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册