Sha256: c00d0c303196c6338af6d3b458b3192053595b9e1eec51edacfd98ec028a658e

Contents?: true

Size: 1.12 KB

Versions: 29

Compression:

Stored size: 1.12 KB

Contents

# frozen_string_literal: true

module NfgUi
  module Components
    module Utilities
      # The library of dedicated theme resources in Evo & DMS
      module ResourceThemeable
        # attr_reader :view_context

        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

        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

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

Version data entries

29 entries across 29 versions & 1 rubygems

Version Path
nfg_ui-0.9.25.1 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.25 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.24.3 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.24.2 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.24.1 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.24 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.23 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.22 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.21 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.20 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.19.1 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.19 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.18.3 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.18.2 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.18.1 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.18 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.17 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.16 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.15 lib/nfg_ui/components/utilities/resource_themeable.rb
nfg_ui-0.9.14 lib/nfg_ui/components/utilities/resource_themeable.rb