2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2019-06-04 03:40:48 +00:00
|
|
|
class KnowledgeBase
|
|
|
|
class ServerSnippet
|
|
|
|
def initialize(knowledge_base)
|
|
|
|
@kb = knowledge_base
|
|
|
|
end
|
|
|
|
|
|
|
|
def render
|
2021-11-15 15:58:19 +00:00
|
|
|
raise Exceptions::UnprocessableEntity, __('Custom address is not set') if @kb.custom_address_uri.nil?
|
2019-06-04 03:40:48 +00:00
|
|
|
|
|
|
|
template_rewrite = host.present? ? template_full : template_path
|
2020-09-30 09:07:01 +00:00
|
|
|
"#{template_rewrite}\n#{template_original_url}"
|
2019-06-04 03:40:48 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def host
|
|
|
|
@kb.custom_address_uri&.host
|
|
|
|
end
|
|
|
|
|
|
|
|
def path
|
|
|
|
@kb.custom_address_uri&.path || ''
|
|
|
|
end
|
|
|
|
|
|
|
|
def template_path; end
|
|
|
|
|
|
|
|
def template_full; end
|
|
|
|
|
|
|
|
def template_original_url; end
|
|
|
|
end
|
|
|
|
end
|