Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Helper#icon prepends fa- to given fa class string #106

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Helper#icon prepends fa- to multiple classes, to get <i class='fa fa-…
…flag fa-2x'> now we can do:

- icon('flag 2x')
- icon([:flag, '2x'])
  • Loading branch information
nnattawat committed Nov 12, 2015
commit 825bbacc19e56116176e0b9a35d2da75690864ec
4 changes: 2 additions & 2 deletions lib/font_awesome/sass/rails/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ module ViewHelpers
def icon(icon, text = nil, html_options = {})
text, html_options = nil, text if text.is_a?(Hash)

icons = icon.split(" ").map { |icon| "fa-#{icon}" }.join(" ")
content_class = "fa #{icons}"
icons = icon.is_a?(Array) ? icon : icon.to_s.split(" ")
content_class = "fa #{icons.map { |i| "fa-#{i}" }.join(' ')}"
content_class << " #{html_options[:class]}" if html_options.key?(:class)
html_options[:class] = content_class

Expand Down