summaryrefslogtreecommitdiff
path: root/app/helpers/icons_helper.rb
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-01-28 02:41:36 -0500
committerRobert Speicher <rspeicher@gmail.com>2015-01-28 03:37:44 -0500
commit8633bbc9b852d8809f20db86a3cdfa2cd3b8dd95 (patch)
tree7e59da9820d054a411ff309144566f2ab3d9c981 /app/helpers/icons_helper.rb
parent8eb365c0a04b912d2e10eb16adeeb4216563be2c (diff)
downloadgitlab-ce-8633bbc9b852d8809f20db86a3cdfa2cd3b8dd95.tar.gz
Add `icon` helper method
Diffstat (limited to 'app/helpers/icons_helper.rb')
-rw-r--r--app/helpers/icons_helper.rb19
1 files changed, 14 insertions, 5 deletions
diff --git a/app/helpers/icons_helper.rb b/app/helpers/icons_helper.rb
index aaa8f8d0077..61c03d90072 100644
--- a/app/helpers/icons_helper.rb
+++ b/app/helpers/icons_helper.rb
@@ -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