# frozen_string_literal: true
module SmartAnnotations
class HtmlPreview
class << self
def html(name, type, object)
send("generate_#{type}_snippet", name, object)
end
private
ROUTES = Rails.application.routes.url_helpers
def generate_prj_snippet(_, object)
if object.archived?
return "Prj #{object.name}" \
"#{I18n.t('atwho.res.archived')}"
end
"Prj " \
"#{object.name}"
end
def generate_exp_snippet(_, object)
if object.archived?
return "Exp " \
"#{object.name} #{I18n.t('atwho.res.archived')}"
end
"Exp " \
"#{object.name}"
end
def generate_tsk_snippet(_, object)
if object.archived?
return "Tsk #{object.name} #{I18n.t('atwho.res.archived')}"
end
"Tsk " \
"" \
"#{object.name}"
end
def generate_rep_item_snippet(name, object)
if object
repository_name = object.repository.name
return "" \
"#{trim_repository_name(repository_name)} " \
"#{object.name}"
end
"Rep " \
"#{name} #{I18n.t('atwho.res.deleted')}"
end
def trim_repository_name(name)
name.strip.slice(0..2).capitalize
end
end
end
end