Merge pull request #4125 from aignatov-bio/ai-sci-6854-update-pdf-report

Update PDF report with new step structure [SCI-6854]
This commit is contained in:
aignatov-bio 2022-05-30 13:46:32 +02:00 committed by GitHub
commit 36ffbb0eab
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 32 additions and 10 deletions

View file

@ -9,6 +9,11 @@
</div>
</div>
<div class="report-element-body">
<div class="pull-left protocol-name">
<h4>
<%= protocol.name %>
</h4>
</div>
<div class="row module-protocol-description">
<% if protocol.description.present? %>
<%= custom_auto_link(protocol.prepare_for_report(:description, export_all),

View file

@ -2,9 +2,7 @@
<% step_type_str = step.completed ? 'completed' : 'uncompleted' %>
<% user = step.completed? && step.last_modified_by || step.user %>
<% timestamp = step.completed ? step.completed_on : step.created_at %>
<% tables = step.tables %>
<% assets = step.assets %>
<% checklists = step.checklists %>
<% export_all = defined?(export_all) && export_all %>
<div class="report-element report-step-element">
<div class="report-element-header">
@ -39,9 +37,15 @@
</div>
</div>
<div class="report-element-children">
<% if @settings.dig('task', 'protocol', 'step_tables') %>
<% tables.each do |table| %>
<%= render partial: 'reports/elements/step_table_element.html.erb', locals: { table: table, export_all: export_all } %>
<% step.step_orderable_elements.order(:position).each do |e| %>
<% if e.orderable_type == 'StepTable' && @settings.dig('task', 'protocol', 'step_tables') %>
<%= render partial: 'reports/elements/step_table_element.html.erb', locals: { table: e.orderable.table, export_all: export_all } %>
<% end %>
<% if e.orderable_type == 'Checklist' && @settings.dig('task', 'protocol', 'step_checklists') %>
<%= render partial: 'reports/elements/step_checklist_element.html.erb', locals: { checklist: e.orderable, export_all: export_all } %>
<% end %>
<% if e.orderable_type == 'StepText' %>
<%= render partial: 'reports/elements/step_text_element.html.erb', locals: { step_text: e.orderable, export_all: export_all } %>
<% end %>
<% end %>
<% if @settings.dig('task', 'protocol', 'step_files') %>
@ -49,11 +53,6 @@
<%= render partial: 'reports/elements/step_asset_element.html.erb', locals: { asset: asset, export_all: export_all } %>
<% end %>
<% end %>
<% if @settings.dig('task', 'protocol', 'step_checklists') %>
<% checklists.each do |checklist| %>
<%= render partial: 'reports/elements/step_checklist_element.html.erb', locals: { checklist: checklist, export_all: export_all } %>
<% end %>
<% end %>
<% if @settings.dig('task', 'protocol', 'step_comments') %>
<%= render partial: 'reports/elements/step_comments_element.html.erb', locals: { step: step, export_all: export_all } %>
<% end %>

View file

@ -0,0 +1,18 @@
<div class="report-element report-step-attachment-element report-step-text-element">
<div class="report-element-body">
<% if step_text.text.present? %>
<%= custom_auto_link(step_text.prepare_for_report(:text, export_all),
team: current_team,
simple_format: false,
tags: %w(img),
base64_encoded_imgs: export_all) %>
<% else %>
<em><%= t('projects.reports.elements.step.no_description') %></em>
<% end %>
</div>
<% if defined?(children) %>
<div class="report-element-children">
<%= children %>
</div>
<% end %>
</div>