knowledge_base_icon_helper.rb 723 B

1234567891011121314151617181920212223242526
  1. module KnowledgeBaseIconHelper
  2. def icon_for_object(object, iconset)
  3. case object
  4. when KnowledgeBase::Category
  5. icon object.category_icon, iconset
  6. when KnowledgeBase::Answer
  7. icon 'knowledge-base-answer'
  8. when KnowledgeBase
  9. icon 'knowledge-base'
  10. end
  11. end
  12. def icon(icon_identifier, iconset = nil)
  13. return icon_native(icon_identifier) if iconset.nil?
  14. icon_from_set(icon_identifier, iconset)
  15. end
  16. def icon_native(icon_identifier)
  17. render 'knowledge_base/public/icon_native', icon_identifier: icon_identifier
  18. end
  19. def icon_from_set(icon_identifier, iconset)
  20. render 'knowledge_base/public/icon_from_set', iconset: iconset, icon_identifier: icon_identifier
  21. end
  22. end