Created
August 12, 2012 07:02
-
-
Save rspeicher/3330326 to your computer and use it in GitHub Desktop.
icon helper method for FontAwesome
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module ApplicationHelper | |
| # Returns an element for use as a FontAwesome icon | |
| # | |
| # Examples: | |
| # icon('trash') | |
| # icon('refresh large') | |
| def icon(name) | |
| name = name.gsub(/\Aicon-/, '').split(' ').map { |v| "icon-#{v}" } | |
| content_tag(:i, nil, class: name.join(' ')) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment