Merge pull request #2949 from aignatov-bio/ai-sci-5166-add-download-links-to-reports

Add download link to reports [SCI-5166]
This commit is contained in:
aignatov-bio 2020-11-13 11:31:11 +01:00 committed by GitHub
commit 9aba66cd33
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 7 deletions

View file

@ -458,6 +458,7 @@ label {
.report-element-header {
.file-name {
margin-left: 5px;
white-space: nowrap;
}
}

View file

@ -7,10 +7,15 @@ module Reports::Docx::DrawResultAsset
asset = result.asset
timestamp = asset.created_at
asset_url = Rails.application.routes.url_helpers.asset_download_url(asset)
color = @color
@docx.p
@docx.p do
text result.name, italic: true
text ' '
link I18n.t('projects.reports.elements.download'), asset_url do
italic true
end
text ' ' + I18n.t('search.index.archived'), color: color[:gray] if result.archived?
text ' ' + I18n.t('projects.reports.elements.result_asset.file_name', file: asset.file_name)
text ' ' + I18n.t('projects.reports.elements.result_asset.user_time',

View file

@ -6,11 +6,16 @@ module Reports::Docx::DrawStepAsset
return unless asset
timestamp = asset.created_at
asset_url = Rails.application.routes.url_helpers.asset_download_url(asset)
color = @color
@docx.p
@docx.p do
text (I18n.t 'projects.reports.elements.step_asset.file_name', file: asset.file_name), italic: true
text ' '
link I18n.t('projects.reports.elements.download'), asset_url do
italic true
end
text ' '
text I18n.t('projects.reports.elements.step_asset.user_time',
timestamp: I18n.l(timestamp, format: :full)), color: color[:gray]
end

View file

@ -28,8 +28,13 @@
<em><%= t("projects.reports.elements.result_asset.file_name", file: filename) %></em>
</a>
<% else %>
<em><%= t("projects.reports.elements.result_asset.file_name",
file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %></em>
<em>
<%= t("projects.reports.elements.result_asset.file_name",
file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %>
<a href="<%= asset_download_url(asset) %>" class="download-link">
<%= t('projects.reports.elements.download') %>
</a>
</em>
<% end %>
</div>
<div class="pull-left user-time">

View file

@ -10,13 +10,17 @@
<div class="pull-left file-name">
<% if defined? export_all and export_all %>
<a href="<%= path %>">
<em><%=t 'projects.reports.elements.step_asset.file_name',
file: filename %></em>
<em><%= t('projects.reports.elements.step_asset.file_name', file: filename) %></em>
</a>
<% else %>
<em><%=t 'projects.reports.elements.step_asset.file_name',
file: truncate(asset.file_name,
length: Constants::FILENAME_TRUNCATION_LENGTH) %></em>
<em>
<%= t('projects.reports.elements.step_asset.file_name',
file: truncate(asset.file_name, length: Constants::FILENAME_TRUNCATION_LENGTH)) %>
<a href="<%= asset_download_url(asset) %>" class="download-link">
<%= t('projects.reports.elements.download') %>
</a>
</em>
<% end %>
</div>
<div class="pull-left user-time">

View file

@ -444,6 +444,7 @@ en:
appended_image: "Appended image - %{name}"
appended_table: "Appended table"
elements:
download: "[Download]"
modals:
project_contents:
head_title: "Add contents to report"