aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack
diff options
context:
space:
mode:
authorCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-11 11:37:17 -0200
committerCarlos Antonio da Silva <carlosantoniodasilva@gmail.com>2013-02-11 11:37:17 -0200
commitb1c72a3675d57a3a575563acbc120d125d2c667b (patch)
tree022cdaf18f73662feb178a302c2b94f0106de2a5 /actionpack
parent7765ee0e4714b82150e525f9fee80f5b23e91662 (diff)
downloadrails-b1c72a3675d57a3a575563acbc120d125d2c667b.tar.gz
rails-b1c72a3675d57a3a575563acbc120d125d2c667b.tar.bz2
rails-b1c72a3675d57a3a575563acbc120d125d2c667b.zip
Improve changelog entry from #9221 [ci skip]
Diffstat (limited to 'actionpack')
-rw-r--r--actionpack/CHANGELOG.md28
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb6
2 files changed, 16 insertions, 18 deletions
diff --git a/actionpack/CHANGELOG.md b/actionpack/CHANGELOG.md
index 3c62d39e07..6940683c8c 100644
--- a/actionpack/CHANGELOG.md
+++ b/actionpack/CHANGELOG.md
@@ -1,23 +1,21 @@
## Rails 4.0.0 (unreleased) ##
-* Fix `image_alt` method to work with underscored or hyphenated file names.
- Currently, underscored filenames become
- `<img alt="A_long_file_name_with_underscores"` in HTML, which is
- poor for accessibility; Apple's VoiceOver Utility pronounces
- each underscore. "A_long_file_name" thus becomes "A underscore
- long underscore file underscore name." This patch makes underscored
- or hyphenated file names (both of which are very popular naming
- conventions) read more naturally in screen readers by converting
- both hyphens and underscores to spaces.
+* Change `image_alt` method to replace underscores/hyphens to spaces in filenames.
- Example:
- # current implementation
- image_tag('underscored_file_name.png')
- #=> <img alt="Underscored_file_name" src="/assets/underscored_file_name.png" />
+ Previously, underscored filenames became `alt="A_long_file_name_with_underscores"`
+ in HTML, which is poor for accessibility. For instance, Apple's VoiceOver Utility
+ pronounces each underscore. `A_long_file_name` thus would be read as `A underscore
+ long underscore file underscore name.` Now underscored or hyphenated filenames
+ (both of which are very popular naming conventions) read more naturally in
+ screen readers by converting both hyphens and underscores to spaces.
- # this patch
+ Before:
+ image_tag('underscored_file_name.png')
+ # => <img alt="Underscored_file_name" src="/assets/underscored_file_name.png" />
+
+ After:
image_tag('underscored_file_name.png')
- #=> <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
+ # => <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
*Nick Cox*
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index 6387b89a81..31e37893c6 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -215,11 +215,11 @@ module ActionView
# Returns a string suitable for an html image tag alt attribute.
# The +src+ argument is meant to be an image file path.
- # The method removes the basename of the file path and the digest,
+ # The method removes the basename of the file path and the digest,
# if any. It also removes hyphens and underscores from file names and
# replaces them with spaces, returning a space-separated, titleized
# string.
- #
+ #
# ==== Examples
#
# image_tag('rails.png')
@@ -227,7 +227,7 @@ module ActionView
#
# image_tag('hyphenated-file-name.png')
# # => <img alt="Hyphenated file name" src="/assets/hyphenated-file-name.png" />
- #
+ #
# image_tag('underscored_file_name.png')
# # => <img alt="Underscored file name" src="/assets/underscored_file_name.png" />
def image_alt(src)