No commit activity in last 3 years
No release in over 3 years
Prevents default Rails behavior for image_tag alt text (uses the file name, which can be long and ugly). Instead, this outputs no alt text unless you specify some.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0
~> 1.8
~> 3.12
~> 2.13

Runtime

 Project Readme

Prevents default Rails behavior for image_tag alt text (uses the file name, which can be long and ugly). Instead, this outputs no alt text unless you specify some.

Works by monkey patching ActionView::Helpers::AssetTagHelper's image_tag method and just setting nil as the alt text if nothing else is set. Setting nil is sufficient for preventing Rails from doing the ugly filename thing.

Installation

gem install image_tag_with_sane_alt

Usage

Just works! Keep using image_tag like normal.

Todo

  • It would be cool to allow circumventing this behavior by respecting an option passed to image_tag. Maybe :default_alt_behavior => true?
  • Specs would be nice.

Contact

Problems, comments, and pull requests all welcome. Find me on GitHub.

Copyright

Copyright © 2013 Todd Eichel. See LICENSE.txt for further details.