Module: IconHelper

Defined in:
app/helpers/icon_helper.rb

Instance Method Summary collapse

Instance Method Details

#awesome_icon(icon_key) ⇒ Object

This includes an icon from the Font-Awesome icon set: fortawesome.github.io/Font-Awesome/icons/

This inserts something like

<i class="fa fa-beer fa-2x"></i>


24
25
26
27
28
29
# File 'app/helpers/icon_helper.rb', line 24

def awesome_icon(icon_key)
  # This helper is defined in:
  # https://github.com/bokmann/font-awesome-rails
  
  fa_icon icon_key
end

#glyphicon(icon_key) ⇒ Object

This includes an icon from Twitter-Bootstrap’s Glyphicon icon set: getbootstrap.com/components/#glyphicons



14
15
16
# File 'app/helpers/icon_helper.rb', line 14

def glyphicon(icon_key)
   :span, '', class: "glyphicon glyphicon-#{icon_key}", 'aria-hidden' => true
end

#icon(icon_key) ⇒ Object



3
4
5
6
7
8
9
# File 'app/helpers/icon_helper.rb', line 3

def icon(icon_key)
  if icon_key.to_s.in? ['beer', 'coffee', 'key', 'unlock-alt']
    awesome_icon(icon_key)
  else
    glyphicon(icon_key)
  end
end

#large_awesome_icon(icon_key) ⇒ Object



31
32
33
# File 'app/helpers/icon_helper.rb', line 31

def large_awesome_icon(icon_key)
  fa_icon "#{icon_key} 2x"
end