Module: UrijiIcons::Rails::IconHelper

Defined in:
app/helpers/uriji_icons/rails/icon_helper.rb

Defined Under Namespace

Modules: Private

Constant Summary collapse

COLOR_ICONS =
{
  'bell': 10,
  'comments-dots': 8,
  'credit-card': 6,
  'rocket': 9
}.freeze

Instance Method Summary collapse

Instance Method Details

#uj_color_icon(key, options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
31
# File 'app/helpers/uriji_icons/rails/icon_helper.rb', line 22

def uj_color_icon(key, options = {})
  icon_name = "uj-#{key}-color"
  options = options.merge(class: "#{icon_name} #{options[:class]}")
  (:i, options) do
    paths = COLOR_ICONS[key.to_sym]
    paths.times.reduce(ActiveSupport::SafeBuffer.new) do |tags, i|
      tags + (:span, nil, class: "path#{i + 1}")
    end
  end
end

#uj_icon(names = 'flag', original_options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'app/helpers/uriji_icons/rails/icon_helper.rb', line 11

def uj_icon(names = 'flag', original_options = {})
  options = original_options.deep_dup
  classes = []
  classes.concat Private.icon_names(names)
  classes.concat Array(options.delete(:class))
  text = options.delete(:text)
  right_icon = options.delete(:right)
  icon = (:i, nil, options.merge(class: classes))
  Private.icon_join(icon, text, right_icon)
end