Module: NfgUi::Components::Utilities::ResourceThemeable

Included in:
ResourceThemesHelper
Defined in:
lib/nfg_ui/components/utilities/resource_themeable.rb

Overview

The library of dedicated theme resources in Evo & DMS

Instance Method Summary collapse

Instance Method Details

#resource_theme_color(object = nil) ⇒ Object

attr_reader :view_context



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/nfg_ui/components/utilities/resource_themeable.rb', line 10

def resource_theme_color(object = nil)
  resource_theme_name = resource_theme_name(object)
  case resource_theme_name
  when 'Project'
    'primary'
  when 'Campaign'
    'primary'
  else
    'primary'
  end
end

#resource_theme_icon(object = nil) ⇒ Object



36
37
38
39
40
41
42
43
44
45
# File 'lib/nfg_ui/components/utilities/resource_themeable.rb', line 36

def resource_theme_icon(object = nil)
  case resource_theme_name(object)
  when 'Project'
    'bullhorn'
  when 'Campaign'
    'bullhorn'
  else
    'heart-o'
  end
end

#resource_theme_name(object = nil) ⇒ Object



22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/nfg_ui/components/utilities/resource_themeable.rb', line 22

def resource_theme_name(object = nil)
  if object.present?
    if object.is_a?(String)
      object
    elsif object.is_a?(Class)
      object.name
    else
      object.class.name
    end
  else
    controller_name.split('/').last.classify
  end
end