Skip to content

Instantly share code, notes, and snippets.

@rspeicher
Created August 12, 2012 07:02
Show Gist options
  • Select an option

  • Save rspeicher/3330326 to your computer and use it in GitHub Desktop.

Select an option

Save rspeicher/3330326 to your computer and use it in GitHub Desktop.
icon helper method for FontAwesome
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