From 2a6b33deec63aa4184821ffedf53c95559dea0ae Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Wed, 2 Feb 2022 10:41:57 +0100 Subject: [PATCH] Fix downloading of BioEddie files in reports [SCI-6037] (#3623) --- .../_my_module_result_asset_element.html.erb | 12 +++++++++--- .../reports/elements/_step_asset_element.html.erb | 12 +++++++++--- app/views/shared/file_preview/_content.html.erb | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/app/views/reports/elements/_my_module_result_asset_element.html.erb b/app/views/reports/elements/_my_module_result_asset_element.html.erb index 06856844e..9d05af416 100644 --- a/app/views/reports/elements/_my_module_result_asset_element.html.erb +++ b/app/views/reports/elements/_my_module_result_asset_element.html.erb @@ -25,9 +25,15 @@ <% else %> - <%= t("projects.reports.elements.result_asset.file_name", - file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %> - <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %> + <% if asset.file.metadata[:asset_type] == 'bio_eddie' %> + <%= t("projects.reports.elements.result_asset.file_name", file: truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH)) %> + + <%= t('Download')%> + + <% else %> + <%= t("projects.reports.elements.result_asset.file_name", file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %> + <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %> + <% end %> <% end %> diff --git a/app/views/reports/elements/_step_asset_element.html.erb b/app/views/reports/elements/_step_asset_element.html.erb index 2cf779726..ea23fd175 100644 --- a/app/views/reports/elements/_step_asset_element.html.erb +++ b/app/views/reports/elements/_step_asset_element.html.erb @@ -18,9 +18,15 @@ <% else %> - <%= t('projects.reports.elements.step_asset.file_name', - file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %> - <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %> + <% if asset.file.metadata[:asset_type] == 'bio_eddie' %> + <%= t('projects.reports.elements.step_asset.file_name', file: truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH)) %> + + <%= t('Download')%> + + <% else %> + <%= t('projects.reports.elements.step_asset.file_name', file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %> + <%= link_to t('projects.reports.elements.download'), asset_download_url(asset, disposition: 'attachment'), class: 'download-link', target: :_blank %> + <% end %> <% end %> diff --git a/app/views/shared/file_preview/_content.html.erb b/app/views/shared/file_preview/_content.html.erb index bec387b97..d3ed1dfff 100644 --- a/app/views/shared/file_preview/_content.html.erb +++ b/app/views/shared/file_preview/_content.html.erb @@ -48,7 +48,7 @@ <% end %> <% end %> <% if asset.file.metadata[:asset_type] == 'bio_eddie' %> - + <%= t('Download')%> <% else %>