2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2019-06-04 03:40:48 +00:00
|
|
|
module KnowledgeBaseIconHelper
|
|
|
|
def icon_for_object(object, iconset)
|
|
|
|
case object
|
|
|
|
when KnowledgeBase::Category
|
|
|
|
icon object.category_icon, iconset
|
|
|
|
when KnowledgeBase::Answer
|
|
|
|
icon 'knowledge-base-answer'
|
|
|
|
when KnowledgeBase
|
|
|
|
icon 'knowledge-base'
|
2021-08-16 08:20:07 +00:00
|
|
|
when Array
|
|
|
|
icon 'hashtag' # object[0] override while tag icon is available
|
2019-06-04 03:40:48 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def icon(icon_identifier, iconset = nil)
|
|
|
|
return icon_native(icon_identifier) if iconset.nil?
|
|
|
|
|
|
|
|
icon_from_set(icon_identifier, iconset)
|
|
|
|
end
|
|
|
|
|
|
|
|
def icon_native(icon_identifier)
|
|
|
|
render 'knowledge_base/public/icon_native', icon_identifier: icon_identifier
|
|
|
|
end
|
|
|
|
|
|
|
|
def icon_from_set(icon_identifier, iconset)
|
|
|
|
render 'knowledge_base/public/icon_from_set', iconset: iconset, icon_identifier: icon_identifier
|
|
|
|
end
|
|
|
|
end
|