aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-23 21:36:21 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2011-08-23 21:36:21 -0500
commitd133fd6d290a4812a17cc58c0d7e5cd3895e23f6 (patch)
treebb68df28c1c1140211d64ad6af287419e88e4f22 /actionpack
parent29004de1a2ded5e8705d421ffe60ff6f631110b1 (diff)
downloadrails-d133fd6d290a4812a17cc58c0d7e5cd3895e23f6.tar.gz
rails-d133fd6d290a4812a17cc58c0d7e5cd3895e23f6.tar.bz2
rails-d133fd6d290a4812a17cc58c0d7e5cd3895e23f6.zip
Debug assets shouldn't ignore media type for stylesheets. Closes #2625
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/lib/sprockets/helpers/rails_helper.rb5
-rw-r--r--actionpack/test/template/sprockets_helper_test.rb3
2 files changed, 6 insertions, 2 deletions
diff --git a/actionpack/lib/sprockets/helpers/rails_helper.rb b/actionpack/lib/sprockets/helpers/rails_helper.rb
index 7200ab1ddd..051624d05e 100644
--- a/actionpack/lib/sprockets/helpers/rails_helper.rb
+++ b/actionpack/lib/sprockets/helpers/rails_helper.rb
@@ -43,17 +43,18 @@ module Sprockets
options = sources.extract_options!
debug = options.key?(:debug) ? options.delete(:debug) : debug_assets?
body = options.key?(:body) ? options.delete(:body) : false
+ media = options.key?(:media) ? options.delete(:media) : "screen"
sources.collect do |source|
if debug && asset = asset_paths.asset_for(source, 'css')
asset.to_a.map { |dep|
- stylesheet_link_tag(dep, :debug => false, :body => true)
+ stylesheet_link_tag(dep, :media => media, :debug => false, :body => true)
}.join("\n").html_safe
else
tag_options = {
'rel' => "stylesheet",
'type' => "text/css",
- 'media' => "screen",
+ 'media' => media,
'href' => asset_path(source, 'css', body, :request)
}.merge(options.stringify_keys)
diff --git a/actionpack/test/template/sprockets_helper_test.rb b/actionpack/test/template/sprockets_helper_test.rb
index cac277cf11..b5a0e6cf04 100644
--- a/actionpack/test/template/sprockets_helper_test.rb
+++ b/actionpack/test/template/sprockets_helper_test.rb
@@ -200,6 +200,9 @@ class SprocketsHelperTest < ActionView::TestCase
@config.assets.debug = true
assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="screen" rel="stylesheet" type="text/css" />},
stylesheet_link_tag(:application)
+
+ assert_match %r{<link href="/assets/style-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />\n<link href="/assets/application-[0-9a-f]+.css\?body=1" media="print" rel="stylesheet" type="text/css" />},
+ stylesheet_link_tag(:application, :media => "print")
end
test "alternate asset prefix" do