Sha256: 05aca9c64e535854e85eda5dd0ac0aa7ca5a3947ffdad3e6437bee3ce2f966d1

Contents?: true

Size: 831 Bytes

Versions: 3

Compression:

Stored size: 831 Bytes

Contents

module IconHelper
  # I wanted to make a named param out of label, though this would imply a
  # backwards incompatible change that would require a non-trivial amount of
  # editing.
  #
  # If you want to take this along with the next planned major release, you can
  # use the following CMD in bash (assuming you have silver searcher installed)
  # to get a list of all icon calls that pass anything more than just a name.
  #
  #   ag 'icon\((:|")(\w+), '
  #
  def icon(name, lbl = nil, options = {})
    classes = "fa fa-#{name.to_s.tr('_', '-')}"
    classes = classes.concat(" #{options[:class].to_s}") if options[:class]
    options[:class] = classes

    markup = content_tag :i, nil, options
    lbl ? "#{markup} #{lbl}".html_safe : markup
  end

  def spinner_icon
    icon :spinner, '', class: 'fa-spin'
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
udongo-7.9.0 app/helpers/icon_helper.rb
udongo-7.8.1 app/helpers/icon_helper.rb
udongo-7.8.0 app/helpers/icon_helper.rb