From 1863e031c5abccb941aa80bde46f0a7b05385d56 Mon Sep 17 00:00:00 2001 From: Anton Date: Fri, 24 Jun 2022 14:34:00 +0200 Subject: [PATCH] PDF report fixes [SCI-6924] --- app/assets/stylesheets/reports.scss | 47 ++++++---- .../_my_module_activity_element.html.erb | 38 ++++---- .../elements/_my_module_element.html.erb | 4 + .../_my_module_result_asset_element.html.erb | 91 +++++++++---------- .../elements/_step_checklist_element.html.erb | 2 +- .../elements/_step_comments_element.html.erb | 16 ++-- config/locales/en.yml | 1 + 7 files changed, 104 insertions(+), 95 deletions(-) diff --git a/app/assets/stylesheets/reports.scss b/app/assets/stylesheets/reports.scss index bfb0bba9c..6acced156 100644 --- a/app/assets/stylesheets/reports.scss +++ b/app/assets/stylesheets/reports.scss @@ -251,7 +251,7 @@ label { } .report-element-body { .project-name { - @include font-h2; + @include font-h1; } } @@ -263,26 +263,31 @@ label { // Experiment element style .report-experiment-element { .experiment-name { - @include font-main; + font-size: 21px; + font-weight: bold; } } // Protocol element style .report-module-protocol-element { - .protcol-name { - @include font-small; + .protocol-name { + @include font-main; font-weight: bold; } } /* Module element style */ .report-module-element { - margin-top: 15px; - margin-bottom: 15px; + @include font-button; + + .results-title-name { + @include font-main; + font-weight: bold; + } .report-element-body { .module-name { - @include font-button; + font-size: 19px; font-weight: bold; } @@ -345,7 +350,7 @@ label { } .result-name { - @include font-small; + @include font-main; display: inline-block; font-weight: bold; } @@ -370,7 +375,7 @@ label { .report-result-asset-element { .report-element-header { .file-name { - font-size: 10px; + font-size: 13px; font-weight: bold; } @@ -380,6 +385,8 @@ label { } img { + display: inline; + margin-top: 4em; max-width: 100%; } } @@ -388,7 +395,7 @@ label { .report-result-table-element { .report-element-header { .table-name { - font-size: 10px; + font-size: 13px; font-weight: bold; } } @@ -412,7 +419,7 @@ label { /** Step element style */ .report-step-element { .step-name { - font-size: 11px; + font-size: 15px; font-weight: bold; } @@ -461,7 +468,7 @@ label { .report-step-table-element { .report-element-header { .table-name { - font-size: 10px; + font-size: 13px; font-weight: bold; } } @@ -478,7 +485,7 @@ label { .report-step-asset-element { .report-element-header { .file-name { - font-size: 10px; + font-size: 13px; font-weight: bold; white-space: nowrap; } @@ -497,7 +504,7 @@ label { .report-step-checklist-element { .report-element-header { .checklist-name { - font-size: 10px; + font-size: 13px; font-weight: bold; } } @@ -517,6 +524,12 @@ label { /** Comments element style (generic) */ .report-comments-element { + .comment-message { + .view-mode { + @include font-small; + } + } + .report-element-header { border-bottom: none; @@ -526,7 +539,7 @@ label { .comments-name { color: $color-emperor; - font-size: 10px; + font-size: 13px; font-weight: bold; } } @@ -571,7 +584,7 @@ label { border-bottom: 0; .repository-name { - @include font-small; + @include font-main; font-weight: bold; } } @@ -596,7 +609,7 @@ label { border-bottom: none; .activity-name { - @include font-small; + @include font-main; font-weight: bold; } } diff --git a/app/views/reports/elements/_my_module_activity_element.html.erb b/app/views/reports/elements/_my_module_activity_element.html.erb index b925e7de4..78f54e16f 100644 --- a/app/views/reports/elements/_my_module_activity_element.html.erb +++ b/app/views/reports/elements/_my_module_activity_element.html.erb @@ -8,26 +8,24 @@
-
-
-
    - <% activities.each do |activity| %> -
  • - - <%= l(activity.created_at, format: :full) %> - - -   - <% if activity.old_activity? %> - <%= activity.message %> - <% else %> - <%= generate_activity_content(activity, no_links: true) %> - <% end %> - -
  • - <% end %> -
-
+
+
    + <% activities.each do |activity| %> +
  • + + <%= l(activity.created_at, format: :full) %> + + +   + <% if activity.old_activity? %> + <%= activity.message %> + <% else %> + <%= generate_activity_content(activity, no_links: true) %> + <% end %> + +
  • + <% end %> +
<% if defined?(children) %> diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb index 5d927906e..28964acb9 100644 --- a/app/views/reports/elements/_my_module_element.html.erb +++ b/app/views/reports/elements/_my_module_element.html.erb @@ -67,6 +67,10 @@ <%= render partial: 'reports/elements/my_module_step_element.html.erb', locals: { step: step, export_all: export_all } %> <% end %> + +
+ <%= t('projects.reports.elements.module.results') %> +

<% order_results_for_report(my_module.results, @settings.dig('task', 'result_order')).each do |result| %> <% if result.is_asset && @settings.dig('task', 'file_results') %> <%= render partial: 'reports/elements/my_module_result_asset_element.html.erb', locals: { result: result, report: report, export_all: export_all } %> 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 b82fee7e2..89669cb36 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 @@ -3,60 +3,55 @@ <% timestamp = asset.created_at %>
-
-
- <%= file_extension_icon_html(asset, true) %> -
-
- <%= result.name %> - <% if result.archived? %> - <%= t('search.index.archived') %> - <% end %> -
-
- <% if defined? export_all and export_all %> - <% if @obj_filenames.dig(:assets, asset.id, :bio_eddie) %> - <% file_link = @obj_filenames.dig(:assets, asset.id, :bio_eddie) %> - <% else %> - <% file_link = @obj_filenames.dig(:assets, asset.id, :file) %> - <% end %> - - <%= file_link&.split('/')&.last %> - +
+ <%= file_extension_icon_html(asset, true) %> +
+
+ <%= result.name %> + <% if result.archived? %> + <%= t('search.index.archived') %> + <% end %> +
+
+ <% if defined? export_all and export_all %> + <% if @obj_filenames.dig(:assets, asset.id, :bio_eddie) %> + <% file_link = @obj_filenames.dig(:assets, asset.id, :bio_eddie) %> <% else %> - - <% if asset.file.metadata[:asset_type] == 'bio_eddie' %> - <%= truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH) %> - - <%= t('Download')%> - - <% else %> - <%= 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 %> - + <% file_link = @obj_filenames.dig(:assets, asset.id, :file) %> <% end %> -
-
- <%= 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) %> - <%= t('projects.reports.elements.result_asset.full_preview_attached') %> - <% end %> -
+ + <%= file_link&.split('/')&.last %> + + <% else %> + + <% if asset.file.metadata[:asset_type] == 'bio_eddie' %> + <%= truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH) %> + + <%= t('Download')%> + + <% else %> + <%= 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 %> +
+
+ <%= 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) %> + <%= t('projects.reports.elements.result_asset.full_preview_attached') %> + <% end %>
-
<% if asset.previewable? && !asset.list? %>
-
-
- <% if defined?(export_all) && export_all %> - - <% else %> - <%= report_image_asset_url(asset) %> - <% end %> -
-
+
+ <% if defined?(export_all) && export_all %> + + <% else %> + <%= report_image_asset_url(asset) %> + <% end %> +
<% end %>
diff --git a/app/views/reports/elements/_step_checklist_element.html.erb b/app/views/reports/elements/_step_checklist_element.html.erb index 11d7445b4..a7e935ae9 100644 --- a/app/views/reports/elements/_step_checklist_element.html.erb +++ b/app/views/reports/elements/_step_checklist_element.html.erb @@ -5,7 +5,7 @@
- <%= custom_auto_link(name: checklist.name, + <%= custom_auto_link(checklist.name, team: current_team, base64_encoded_imgs: export_all) %>
diff --git a/app/views/reports/elements/_step_comments_element.html.erb b/app/views/reports/elements/_step_comments_element.html.erb index 780566379..040d8bc7a 100644 --- a/app/views/reports/elements/_step_comments_element.html.erb +++ b/app/views/reports/elements/_step_comments_element.html.erb @@ -9,15 +9,13 @@
-
-
-
    - <% comments.each do |comment| %> - <%= render partial: 'shared/comments/item.html.erb', - locals: { comment: comment, readonly: true, report: true, export_all: export_all } %> - <% end %> -
-
+
+
    + <% comments.each do |comment| %> + <%= render partial: 'shared/comments/item.html.erb', + locals: { comment: comment, readonly: true, report: true, export_all: export_all } %> + <% end %> +
<% if defined?(children) %> diff --git a/config/locales/en.yml b/config/locales/en.yml index ddf57c674..a6ed355eb 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -713,6 +713,7 @@ en: no_description: "No description" tags_header: "Task tags:" no_tags: "No tags" + results: "Results" protocol: name: 'Protocol' user_time: "Protocol created on %{timestamp}."