diff --git a/app/assets/stylesheets/reports.scss b/app/assets/stylesheets/reports.scss index c62e31a2a..ddd2aca16 100644 --- a/app/assets/stylesheets/reports.scss +++ b/app/assets/stylesheets/reports.scss @@ -244,14 +244,16 @@ label { /* Project header element style */ .report-project-header-element { - margin-bottom: 20px; + margin-bottom: 0; .report-element-header { border-bottom: none; } + .report-element-body { .project-name { @include font-h1; + margin-top: 0; } } @@ -617,7 +619,7 @@ label { margin: 3px 2px; .activity-prefix { - color: $color-emperor; + color: $color-silver-chalice; } } } diff --git a/app/services/reports/docx/draw_my_module.rb b/app/services/reports/docx/draw_my_module.rb index b5d9b4415..7f0f5380e 100644 --- a/app/services/reports/docx/draw_my_module.rb +++ b/app/services/reports/docx/draw_my_module.rb @@ -73,7 +73,7 @@ module Reports::Docx::DrawMyModule @docx.h4 I18n.t('Results') if my_module.results.any? order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| if result.is_asset && @settings.dig('task', 'file_results') - draw_result_asset(result) + draw_result_asset(result, @settings) elsif result.is_table && @settings.dig('task', 'table_results') draw_result_table(result) elsif result.is_text && @settings.dig('task', 'text_results') diff --git a/app/services/reports/docx/draw_project_header.rb b/app/services/reports/docx/draw_project_header.rb index 12852214c..dd71dc267 100644 --- a/app/services/reports/docx/draw_project_header.rb +++ b/app/services/reports/docx/draw_project_header.rb @@ -19,8 +19,6 @@ module Reports::Docx::DrawProjectHeader text I18n.t('projects.reports.elements.project_header.user_time', code: project.code, timestamp: I18n.l(project.created_at, format: :full)), color: color[:gray] br - br - br end end end diff --git a/app/services/reports/docx/draw_result_asset.rb b/app/services/reports/docx/draw_result_asset.rb index 93eb6fa4c..277a33286 100644 --- a/app/services/reports/docx/draw_result_asset.rb +++ b/app/services/reports/docx/draw_result_asset.rb @@ -1,7 +1,7 @@ # frozen_string_literal: true module Reports::Docx::DrawResultAsset - def draw_result_asset(result) + def draw_result_asset(result, settings) asset = result.asset timestamp = asset.created_at asset_url = Rails.application.routes.url_helpers.asset_download_url(asset) @@ -27,6 +27,10 @@ module Reports::Docx::DrawResultAsset text ' ' + I18n.t('projects.reports.elements.result_asset.file_name', file: asset.file_name) text ' ' + I18n.t('projects.reports.elements.result_asset.user_time', user: result.user.full_name, timestamp: I18n.l(timestamp, format: :full)), color: color[:gray] + + if settings.dig(:task, :file_results_previews) && ActiveStorageFileUtil.previewable_document?(asset&.file&.blob) + text " #{I18n.t('projects.reports.elements.result_asset.full_preview_attached')}", color: color[:gray] + end end draw_result_comments(result) if @settings.dig('task', 'result_comments') diff --git a/app/utilities/active_storage_file_util.rb b/app/utilities/active_storage_file_util.rb index 1bdf89a75..d8cb9f595 100644 --- a/app/utilities/active_storage_file_util.rb +++ b/app/utilities/active_storage_file_util.rb @@ -20,4 +20,6 @@ module ActiveStorageFileUtil previewable end + + module_function :previewable_document? end diff --git a/app/views/reports/elements/_my_module_protocol_element.html.erb b/app/views/reports/elements/_my_module_protocol_element.html.erb index a3e84d710..2a8b91f9a 100644 --- a/app/views/reports/elements/_my_module_protocol_element.html.erb +++ b/app/views/reports/elements/_my_module_protocol_element.html.erb @@ -2,13 +2,13 @@ <% export_all = defined?(export_all) && export_all %>
-
+

<% if protocol.name.present? %> <%= protocol.name %> <% else %> <%= t('projects.reports.elements.module.protocol.name') %> <% end %> -

+
<%= t('projects.reports.elements.module.protocol.user_time', code: protocol.code, timestamp: l(protocol.created_at, format: :full)) %>
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 89669cb36..d4b2ba53c 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 @@ -38,7 +38,7 @@
<%= t("projects.reports.elements.result_asset.user_time", user: result.user.full_name, timestamp: l(timestamp, format: :full)) %> - <% if report.settings.dig(:task, :file_results_previews) %> + <% if report.settings.dig(:task, :file_results_previews) && ActiveStorageFileUtil.previewable_document?(asset&.file&.blob) %> <%= t('projects.reports.elements.result_asset.full_preview_attached') %> <% end %>