Add `icon` helper method

This commit is contained in:
Robert Speicher 2015-01-28 02:41:36 -05:00
parent 8eb365c0a0
commit 8633bbc9b8
1 changed files with 14 additions and 5 deletions

View File

@ -1,21 +1,30 @@
module IconsHelper
# Creates an icon tag given icon name(s) and possible icon modifiers.
#
# Right now this method simply delegates directly to `fa_icon` from the
# font-awesome-rails gem, but should we ever use a different icon pack in the
# future we won't have to change hundreds of method calls.
def icon(names, options = {})
fa_icon(names, options)
end
def boolean_to_icon(value)
if value.to_s == "true"
content_tag :i, nil, class: 'fa fa-circle cgreen'
icon('circle', class: 'cgreen')
else
content_tag :i, nil, class: 'fa fa-power-off clgray'
icon('power-off', class: 'clgray')
end
end
def public_icon
content_tag :i, nil, class: 'fa fa-globe'
icon('globe')
end
def internal_icon
content_tag :i, nil, class: 'fa fa-shield'
icon('shield')
end
def private_icon
content_tag :i, nil, class: 'fa fa-lock'
icon('lock')
end
end