Created
January 18, 2013 11:17
-
-
Save sstarr/4563999 to your computer and use it in GitHub Desktop.
Rails helper to generate Twitter Bootstrap icons
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
# Generate Twitter Bootstrap icons with a minimum of fuss | |
# Use in views like so: | |
# icon('pencil') => content_tag(:i, '', class: 'icon-pencil') | |
# icon('trash', 'icon-white huge') => content_tag(:i, '', class: 'icon-trash icon-white huge') | |
def icon(style, extra_class = nil) | |
content_tag(:i, '', class: "icon-#{style}" + (extra_class ? " #{extra_class}" : '')) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment