trabajo-afectivo/app/helpers/knowledge_base_public_page_title_helper.rb

31 lines
739 B
Ruby
Raw Permalink Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module KnowledgeBasePublicPageTitleHelper
def kb_public_page_title(leading, trailing, exception)
[
leading&.translation&.title,
kb_public_page_title_suffix(trailing, exception)
].compact.join(' - ')
end
def kb_public_page_title_suffix(item, exception)
2021-08-16 08:20:07 +00:00
case item
when HasTranslations
return item&.translation&.title if exception.blank?
2021-08-16 08:20:07 +00:00
zt kb_public_page_title_suffix_exception(exception)
when String
item
end
end
2021-08-16 08:20:07 +00:00
def kb_public_page_title_suffix_exception(exception)
case exception
when :not_found
'Not Found'
when :alternatives
'Alternative Translations'
end
end
end