PDF report fixes [SCI-6924]

This commit is contained in:
Anton 2022-06-24 14:34:00 +02:00
parent 7cb9b9777f
commit 1863e031c5
7 changed files with 104 additions and 95 deletions

View file

@ -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;
}
}

View file

@ -8,26 +8,24 @@
</div>
</div>
<div class="report-element-body">
<div class="row">
<div class="col-xs-12 activity-container">
<ul class="no-style activity-list">
<% activities.each do |activity| %>
<li class="activity">
<span class="activity-prefix">
<%= l(activity.created_at, format: :full) %>
</span>
<span class="activity-message">
&nbsp;
<% if activity.old_activity? %>
<%= activity.message %>
<% else %>
<%= generate_activity_content(activity, no_links: true) %>
<% end %>
</span>
</li>
<% end %>
</ul>
</div>
<div class="activity-container">
<ul class="no-style activity-list">
<% activities.each do |activity| %>
<li class="activity">
<span class="activity-prefix">
<%= l(activity.created_at, format: :full) %>
</span>
<span class="activity-message">
&nbsp;
<% if activity.old_activity? %>
<%= activity.message %>
<% else %>
<%= generate_activity_content(activity, no_links: true) %>
<% end %>
</span>
</li>
<% end %>
</ul>
</div>
</div>
<% if defined?(children) %>

View file

@ -67,6 +67,10 @@
<%= render partial: 'reports/elements/my_module_step_element.html.erb', locals: { step: step, export_all: export_all } %>
<% end %>
<div class="pull-left results-title-name">
<%= t('projects.reports.elements.module.results') %>
</div><br>
<% 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 } %>

View file

@ -3,60 +3,55 @@
<% timestamp = asset.created_at %>
<div class="report-element report-result-element report-result-asset-element">
<div class="report-element-header">
<div class="row">
<div class="result-icon">
<%= file_extension_icon_html(asset, true) %>
</div>
<div class="result-name">
<%= result.name %>
<% if result.archived? %>
<span class="label label-warning"><%= t('search.index.archived') %></span>
<% end %>
</div>
<div class="file-name">
<% 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 %>
<a href="<%= file_link %>" class="export-all-link" >
<em><%= file_link&.split('/')&.last %></em>
</a>
<div class="result-icon">
<%= file_extension_icon_html(asset, true) %>
</div>
<div class="result-name">
<%= result.name %>
<% if result.archived? %>
<span class="label label-warning"><%= t('search.index.archived') %></span>
<% end %>
</div>
<div class="file-name">
<% 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 %>
<em>
<% if asset.file.metadata[:asset_type] == 'bio_eddie' %>
<%= truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH) %>
<a class="btn btn-light file-download-link" href="data:text/plain;charset=utf-8,<%= asset.file.metadata[:description] %>" download="<%= asset.file.metadata[:name] %>.helm" data-turbolinks="false">
<span class="fas fa-download"></span> <%= t('Download')%>
</a>
<% 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 %>
</em>
<% file_link = @obj_filenames.dig(:assets, asset.id, :file) %>
<% end %>
</div>
<div class="user-time">
<%= 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 %>
</div>
<a href="<%= file_link %>" class="export-all-link" >
<em><%= file_link&.split('/')&.last %></em>
</a>
<% else %>
<em>
<% if asset.file.metadata[:asset_type] == 'bio_eddie' %>
<%= truncate("#{asset.file.metadata[:name]}.helm", length: Constants::FILENAME_TRUNCATION_LENGTH) %>
<a class="btn btn-light file-download-link" href="data:text/plain;charset=utf-8,<%= asset.file.metadata[:description] %>" download="<%= asset.file.metadata[:name] %>.helm" data-turbolinks="false">
<span class="fas fa-download"></span> <%= t('Download')%>
</a>
<% 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 %>
</em>
<% end %>
</div>
<div class="user-time">
<%= 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 %>
</div>
</div>
<div class="row"></div>
<% if asset.previewable? && !asset.list? %>
<div class="report-element-body">
<div class="row">
<div class="col-xs-12 file-image">
<% if defined?(export_all) && export_all %>
<img class="report-export-img" src="<%= @obj_filenames.dig(:assets, asset.id, :preview) %>">
<% else %>
<%= report_image_asset_url(asset) %>
<% end %>
</div>
</div>
<div class="file-image">
<% if defined?(export_all) && export_all %>
<img class="report-export-img" src="<%= @obj_filenames.dig(:assets, asset.id, :preview) %>">
<% else %>
<%= report_image_asset_url(asset) %>
<% end %>
</div>
</div>
<% end %>
<div class="report-element-children">

View file

@ -5,7 +5,7 @@
<div class="report-element report-step-attachment-element report-step-checklist-element">
<div class="report-element-header">
<div class="checklist-name">
<%= custom_auto_link(name: checklist.name,
<%= custom_auto_link(checklist.name,
team: current_team,
base64_encoded_imgs: export_all) %>
</div>

View file

@ -9,15 +9,13 @@
</div>
</div>
<div class="report-element-body">
<div class="row">
<div class="col-xs-12 comments-container simple">
<ul class="no-style content-comments">
<% comments.each do |comment| %>
<%= render partial: 'shared/comments/item.html.erb',
locals: { comment: comment, readonly: true, report: true, export_all: export_all } %>
<% end %>
</ul>
</div>
<div class="comments-container simple">
<ul class="no-style content-comments">
<% comments.each do |comment| %>
<%= render partial: 'shared/comments/item.html.erb',
locals: { comment: comment, readonly: true, report: true, export_all: export_all } %>
<% end %>
</ul>
</div>
</div>
<% if defined?(children) %>

View file

@ -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}."