Fix global links in reports (#1894)

This commit is contained in:
aignatov-bio 2019-07-09 09:35:43 +02:00 committed by GitHub
parent 4fe3119bd2
commit c8b0d87054
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -35,6 +35,11 @@ class Reports::Docx
end
@docx
end
def self.link_prepare(scinote_url, link)
link[0] == '/' ? scinote_url + link : link
end
end
# rubocop:enable Style/ClassAndModuleChildren

View file

@ -39,7 +39,8 @@ module PrivateMethods
br
elsif text_el[:type] == 'a'
if text_el[:link]
link text_el[:value], scinote_url + text_el[:link], link_style
link_url = Reports::Docx.link_prepare(scinote_url, text_el[:link])
link text_el[:value], link_url, link_style
else
text text_el[:value], link_style
end