aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers
diff options
context:
space:
mode:
authorXavier Noria <fxn@hashref.com>2011-06-27 23:00:05 +0200
committerXavier Noria <fxn@hashref.com>2011-06-27 23:00:05 +0200
commita0960ec2d4476763d6975e3df6806cf99f24ead9 (patch)
tree379c8c3526163e63f82588f29f20ddbdc238b68c /actionpack/lib/action_view/helpers
parentf63f0baa59356fcb68beed46d4d6a26248c6385c (diff)
downloadrails-a0960ec2d4476763d6975e3df6806cf99f24ead9.tar.gz
rails-a0960ec2d4476763d6975e3df6806cf99f24ead9.tar.bz2
rails-a0960ec2d4476763d6975e3df6806cf99f24ead9.zip
the generated ALT attribute for images no longer contains the digest, if any
Diffstat (limited to 'actionpack/lib/action_view/helpers')
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 7970176d37..c442c20acd 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -347,7 +347,7 @@ module ActionView
src = options[:src] = path_to_image(source)
unless src =~ /^cid:/
- options[:alt] = options.fetch(:alt){ File.basename(src, '.*').capitalize }
+ options[:alt] = options.fetch(:alt){ image_alt(src) }
end
if size = options.delete(:size)
@@ -362,6 +362,10 @@ module ActionView
tag("img", options)
end
+ def image_alt(src)
+ File.basename(src, '.*').gsub(/-[[:xdigit:]]{32}\z/, '').capitalize
+ end
+
# Returns an html video tag for the +sources+. If +sources+ is a string,
# a single video tag will be returned. If +sources+ is an array, a video
# tag with nested source tags for each source will be returned. The