Module: RailsBootstrapHelpers::Helpers::BaseHelper

Defined in:
lib/rails-bootstrap-helpers/helpers/base_helper.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.icon(icon, options = {}) ⇒ Object

Renders the given icon

Renders an i tag with the class “icon-#icon

Options

Parameters:

  • icon (String, Symbol)

    the kind of icon to render

  • :invert (Boolean)

    if the color of the icon should be inverted



10
11
12
13
14
15
16
17
18
19
# File 'lib/rails-bootstrap-helpers/helpers/base_helper.rb', line 10

def self.icon (icon, options = {})
  icon = ERB::Util.html_escape(icon.to_s)
  cls = "icon-" + icon

  if invert = options.delete(:invert)
    cls << " icon-white"
  end

  "<i class=\"#{cls}\"></i>".html_safe
end

Instance Method Details

#icon(icon, options = {}) ⇒ Object

Renders the given icon

Renders an i tag with the class “icon-#icon

Options

Parameters:

  • icon (String, Symbol)

    the kind of icon to render

  • :invert (Boolean)

    if the color of the icon should be inverted



29
30
31
# File 'lib/rails-bootstrap-helpers/helpers/base_helper.rb', line 29

def icon (icon, options = {})
  RailsBootstrapHelpers::Helpers::BaseHelper.icon(icon, options)
end