Sha256: 0bc79666e9a107eda69b7dbe77723712c3b18e1df2456485074e8c2ee8dcd944

Contents?: true

Size: 765 Bytes

Versions: 19

Compression:

Stored size: 765 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
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
udongo-7.7.2 app/helpers/icon_helper.rb
udongo-7.7.1 app/helpers/icon_helper.rb
udongo-7.7.0 app/helpers/icon_helper.rb
udongo-7.6.2 app/helpers/icon_helper.rb
udongo-7.6.1 app/helpers/icon_helper.rb
udongo-7.6.0 app/helpers/icon_helper.rb
udongo-7.5.1 app/helpers/icon_helper.rb
udongo-7.5.0 app/helpers/icon_helper.rb
udongo-7.4.2 app/helpers/icon_helper.rb
udongo-7.4.1 app/helpers/icon_helper.rb
udongo-7.4.0 app/helpers/icon_helper.rb
udongo-7.3.5 app/helpers/icon_helper.rb
udongo-7.3.4 app/helpers/icon_helper.rb
udongo-7.3.3 app/helpers/icon_helper.rb
udongo-7.3.2 app/helpers/icon_helper.rb
udongo-7.3.1 app/helpers/icon_helper.rb
udongo-7.2.1 app/helpers/icon_helper.rb
udongo-7.2.0 app/helpers/icon_helper.rb
udongo-7.1.3 app/helpers/icon_helper.rb