2013-11-20 06:41:41 -05:00
|
|
|
module IconsHelper
|
2015-01-28 02:41:36 -05:00
|
|
|
# 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
|
|
|
|
|
2015-01-28 03:30:27 -05:00
|
|
|
def spinner(text = nil, visible = false)
|
|
|
|
css_class = 'loading'
|
|
|
|
css_class << ' hide' unless visible
|
|
|
|
|
|
|
|
content_tag :div, class: css_class do
|
|
|
|
icon('spinner spin') + text
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-11-20 06:41:41 -05:00
|
|
|
def boolean_to_icon(value)
|
|
|
|
if value.to_s == "true"
|
2015-01-28 02:41:36 -05:00
|
|
|
icon('circle', class: 'cgreen')
|
2013-11-20 06:41:41 -05:00
|
|
|
else
|
2015-01-28 02:41:36 -05:00
|
|
|
icon('power-off', class: 'clgray')
|
2013-11-20 06:41:41 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def public_icon
|
2015-01-28 02:41:36 -05:00
|
|
|
icon('globe')
|
2013-11-20 06:41:41 -05:00
|
|
|
end
|
|
|
|
|
2013-11-06 10:13:21 -05:00
|
|
|
def internal_icon
|
2015-01-28 02:41:36 -05:00
|
|
|
icon('shield')
|
2013-11-06 10:13:21 -05:00
|
|
|
end
|
|
|
|
|
2013-11-20 06:41:41 -05:00
|
|
|
def private_icon
|
2015-01-28 02:41:36 -05:00
|
|
|
icon('lock')
|
2013-11-20 06:41:41 -05:00
|
|
|
end
|
|
|
|
end
|