Module: Interage::ApplicationIconHelper

Included in:
ApplicationHelper
Defined in:
lib/interage/application_icon_helper.rb

Constant Summary collapse

ALLOWED_FONT_ICONS =
['fa', 'md'].freeze
DEFAULT_FONT_ICON =
ENV.fetch('DEFAULT_FONT_ICON', 'fa')

Instance Method Summary collapse

Instance Method Details

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



8
9
10
# File 'lib/interage/application_icon_helper.rb', line 8

def app_icon(icon, options = {})
  execute_method("#{DEFAULT_FONT_ICON}_icon", icon, options)
end

#app_icon_classes(icon, prefix, separator, options = {}) ⇒ Object



16
17
18
19
20
# File 'lib/interage/application_icon_helper.rb', line 16

def app_icon_classes(icon, prefix, separator, options = {})
  icon_classes = icon.to_s.split(' ').uniq.join(" #{separator}-")

  "#{prefix} #{separator}-#{icon_classes} #{options[:class]}".strip
end

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



12
13
14
# File 'lib/interage/application_icon_helper.rb', line 12

def app_icon_text(icon, text, options = {})
  execute_method("#{DEFAULT_FONT_ICON}_icon_text", icon, text, options)
end

#execute_method(method_name, *arguments) ⇒ Object



22
23
24
25
26
# File 'lib/interage/application_icon_helper.rb', line 22

def execute_method(method_name, *arguments)
  return unless ALLOWED_FONT_ICONS.include?(DEFAULT_FONT_ICON)

  try(method_name, *arguments)
end