From b9d953b3a4e2ccd72e81f736b4e2d9d8bca00f2a Mon Sep 17 00:00:00 2001 From: Alex Kriuchykhin Date: Thu, 21 Jul 2022 09:57:28 +0200 Subject: [PATCH] Fix pdf report styling and bookmarks [SCI-6978] (#4274) --- app/assets/stylesheets/reports.scss | 1 - .../elements/_experiment_element.html.erb | 4 +- .../elements/_my_module_element.html.erb | 9 +++-- .../_my_module_result_table_element.html.erb | 38 +++++++++---------- .../_my_module_result_text_element.html.erb | 18 +++++---- .../elements/_my_module_step_element.html.erb | 13 +------ .../elements/_project_header_element.html.erb | 4 +- 7 files changed, 41 insertions(+), 46 deletions(-) diff --git a/app/assets/stylesheets/reports.scss b/app/assets/stylesheets/reports.scss index 6acced156..ebc1ef044 100644 --- a/app/assets/stylesheets/reports.scss +++ b/app/assets/stylesheets/reports.scss @@ -411,7 +411,6 @@ label { .text-container { border-radius: 4px; padding: 5px; - background-color: $color-concrete; } } } diff --git a/app/views/reports/elements/_experiment_element.html.erb b/app/views/reports/elements/_experiment_element.html.erb index fa2db5fd2..8ea91e64e 100644 --- a/app/views/reports/elements/_experiment_element.html.erb +++ b/app/views/reports/elements/_experiment_element.html.erb @@ -3,12 +3,12 @@ <% export_all = defined?(export_all) && export_all %>
-
+

<%= link_to experiment.name, canvas_experiment_url(experiment), target: :_blank %> <% if experiment.archived? %> <%= t('search.index.archived') %> <% end %> -

+
<%= t('projects.reports.elements.experiment.user_time', code: experiment.code, timestamp: l(timestamp, format: :full)) %>
diff --git a/app/views/reports/elements/_my_module_element.html.erb b/app/views/reports/elements/_my_module_element.html.erb index 28964acb9..2f0040893 100644 --- a/app/views/reports/elements/_my_module_element.html.erb +++ b/app/views/reports/elements/_my_module_element.html.erb @@ -3,12 +3,12 @@ <% export_all = defined?(export_all) && export_all %>
-
+

<%= link_to my_module.name, protocols_my_module_url(my_module), target: :_blank %> <% if my_module.archived? %> <%= t('search.index.archived') %> <% end %> -

+
<%= t('projects.reports.elements.module.user_time', timestamp: l(timestamp, format: :full)) %>
@@ -68,9 +68,10 @@ <% 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 } %> @@ -80,7 +81,7 @@ <%= render partial: 'reports/elements/my_module_result_text_element.html.erb', locals: { result: result, export_all: export_all } %> <% end %> <% end %> -
+

<% if defined?(children) %>
diff --git a/app/views/reports/elements/_my_module_result_table_element.html.erb b/app/views/reports/elements/_my_module_result_table_element.html.erb index b6e7db5db..704d08d91 100644 --- a/app/views/reports/elements/_my_module_result_table_element.html.erb +++ b/app/views/reports/elements/_my_module_result_table_element.html.erb @@ -1,28 +1,28 @@ <% result ||= report_element.result %> <% table = result.table %> <% timestamp = table.created_at %> -
+<% name = result.name %> +<% export_all = defined?(export_all) && export_all %> +
-
-
- <%= result.name %> - <% if result.archived? %> - <%= t('search.index.archived') %> - <% end %> -
- <% if defined? export_all and export_all %> -
- <% file_link = @obj_filenames.dig(:tables, table.id, :file) %> - - <%= file_link&.split('/')&.last %> - -
+
+ <%= name %> + <% if result.archived? %> + <%= t('search.index.archived') %> <% end %> -
- <%= t('projects.reports.elements.result_table.user_time', user: result.user.full_name , timestamp: l(timestamp, format: :full)) %> -
-
+ <% if defined? export_all and export_all %> +
+ <% file_link = @obj_filenames.dig(:tables, table.id, :file) %> + + <%= file_link&.split('/')&.last %> + +
+ <% end %> +
+ <%= t('projects.reports.elements.result_table.user_time', user: result.user.full_name, timestamp: l(timestamp, format: :full)) %> +
+

diff --git a/app/views/reports/elements/_my_module_result_text_element.html.erb b/app/views/reports/elements/_my_module_result_text_element.html.erb index e9ea2bb9e..de48fbc99 100644 --- a/app/views/reports/elements/_my_module_result_text_element.html.erb +++ b/app/views/reports/elements/_my_module_result_text_element.html.erb @@ -14,14 +14,18 @@
<%= t('projects.reports.elements.result_text.user_time', user: result.user.full_name, timestamp: l(timestamp, format: :full)) %>
-
+

-
- <%= custom_auto_link(result_text.prepare_for_report(:text, export_all), - team: current_team, - simple_format: false, - tags: %w(img), - base64_encoded_imgs: export_all) %> +
+
+
+ <%= custom_auto_link(result_text.prepare_for_report(:text, export_all), + team: current_team, + simple_format: false, + tags: %w(img), + base64_encoded_imgs: export_all) %> +
+
diff --git a/app/views/reports/elements/_my_module_step_element.html.erb b/app/views/reports/elements/_my_module_step_element.html.erb index 2a3bc6502..444984f51 100644 --- a/app/views/reports/elements/_my_module_step_element.html.erb +++ b/app/views/reports/elements/_my_module_step_element.html.erb @@ -6,22 +6,13 @@ <% export_all = defined?(export_all) && export_all %>
-
+
<%= t('projects.reports.elements.step.step_pos', pos: (step.position_plus_one)) %> <%= step.name %> <%= step_status_label(step) %> -
+
<%= t("projects.reports.elements.step.#{step_type_str}.user_time", user: user.full_name , timestamp: l(timestamp, format: :full)) %>
-
- <% if step.description.present? %> - <%= custom_auto_link(step.prepare_for_report(:description, export_all), - team: current_team, - simple_format: false, - tags: %w(img), - base64_encoded_imgs: export_all) %> - <% end %> -
<% step.step_orderable_elements.order(:position).each do |e| %> diff --git a/app/views/reports/elements/_project_header_element.html.erb b/app/views/reports/elements/_project_header_element.html.erb index 1f0f4d5ce..d4a0012b5 100644 --- a/app/views/reports/elements/_project_header_element.html.erb +++ b/app/views/reports/elements/_project_header_element.html.erb @@ -1,12 +1,12 @@ <% project ||= report_element.project %>
-
+

<%= link_to t('projects.reports.elements.project_header.title', project: project.name), project_url(project), target: :_blank %> <% if project.archived? %> <%= t('search.index.archived') %> <% end %> -

+
<%= t('projects.reports.elements.project_header.user_time', timestamp: l(project.created_at, format: :full)) %>