2021-12-01 18:16:45 +08:00
|
|
|
<p class="print-protocol-header">
|
|
|
|
<span><%= t('.header.printed_from') %></span>
|
|
|
|
<span class="print-protocol-header__logo">
|
|
|
|
<%= image_tag 'logo.png' %>
|
|
|
|
</span>
|
|
|
|
<span><%= t('.header.print_info', datetime: l(DateTime.current, format: :full), full_name: current_user.full_name) %></span>
|
|
|
|
</p>
|
|
|
|
|
2023-03-28 18:08:55 +08:00
|
|
|
<h1><%= @protocol.name || @protocol.my_module&.name %></h1>
|
2021-12-03 20:44:18 +08:00
|
|
|
<div>
|
|
|
|
<% if @protocol.description.present? %>
|
|
|
|
<%= custom_auto_link(@protocol.tinymce_render(:description),
|
|
|
|
simple_format: false,
|
|
|
|
tags: %w(img),
|
|
|
|
team: current_team) %>
|
|
|
|
<% else %>
|
|
|
|
<em><%= t('my_modules.protocols.protocol_status_bar.no_description') %></em>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2021-12-01 18:16:45 +08:00
|
|
|
<% @protocol.steps.order(position: :asc).each do |step| %>
|
|
|
|
<div class="print-step">
|
2022-01-14 22:02:04 +08:00
|
|
|
<h2 class="step-check-circle-checked">
|
|
|
|
<% if step.completed_on %>
|
|
|
|
<%= image_tag "check-circle-solid.svg" %>
|
|
|
|
<% else %>
|
|
|
|
<div class="step-check-circle"></div>
|
|
|
|
<% end %>
|
2021-12-01 18:16:45 +08:00
|
|
|
<%= step.position + 1 %>. <%= step.name %>
|
|
|
|
</h2>
|
2022-06-10 16:41:57 +08:00
|
|
|
|
|
|
|
<% step.step_orderable_elements.order(position: :asc).each do |step_element| %>
|
|
|
|
<% case step_element.orderable_type %>
|
|
|
|
<% when 'StepText' %>
|
|
|
|
<% step_text = step_element.orderable %>
|
|
|
|
<div class="print-step-text">
|
|
|
|
<div class="ql-editor">
|
2023-02-07 22:44:53 +08:00
|
|
|
<%= custom_auto_link(step_text.tinymce_render(:text).gsub(/<p>\S<\/p>/, '').strip,
|
2021-12-03 20:44:18 +08:00
|
|
|
simple_format: false,
|
|
|
|
tags: %w(img),
|
2022-03-29 18:09:33 +08:00
|
|
|
team: current_team,
|
|
|
|
preview_repository: true) %>
|
2021-12-03 20:44:18 +08:00
|
|
|
</div>
|
2022-06-10 16:41:57 +08:00
|
|
|
</div>
|
|
|
|
<% when 'StepTable' %>
|
|
|
|
<% table = step_element.orderable.table %>
|
|
|
|
<div class="print-table">
|
|
|
|
<strong>
|
|
|
|
<%= auto_link(simple_format(table.name),
|
|
|
|
link: :urls,
|
|
|
|
html: { target: '_blank' }) %>
|
|
|
|
</strong>
|
|
|
|
<div class="page-break"></div>
|
|
|
|
<div data-role="hot-table" class="hot-table">
|
|
|
|
<%= hidden_field(table, :contents, value: table.contents_utf_8, class: "hot-contents") %>
|
2023-02-14 18:15:42 +08:00
|
|
|
<%= hidden_field(table, :metadata, value: table.metadata ? table.metadata.to_json : nil, class: "hot-metadata" ) %>
|
2022-06-10 16:41:57 +08:00
|
|
|
<div data-role="step-hot-table" class="step-result-hot-table"></div>
|
2021-12-01 18:16:45 +08:00
|
|
|
</div>
|
2021-12-03 20:44:18 +08:00
|
|
|
</div>
|
2022-06-10 16:41:57 +08:00
|
|
|
<% when 'Checklist' %>
|
|
|
|
<% checklist = step_element.orderable %>
|
|
|
|
<div class="print-checklist">
|
|
|
|
<h3><%= smart_annotation_parser(checklist.name, current_team).html_safe %></h3>
|
|
|
|
<% checklist.checklist_items.order(position: :asc).each do |checklist_item| %>
|
|
|
|
<div class="print-checklist-item">
|
|
|
|
<span class="checklist-checkbox checked">
|
|
|
|
<% if checklist_item.checked %>
|
|
|
|
<%= image_tag "check-square-solid.svg" %>
|
|
|
|
<% else %>
|
|
|
|
<span class="checklist-checkbox not-checked"></span>
|
|
|
|
<% end %>
|
|
|
|
<%= smart_annotation_parser(checklist_item.text, current_team).html_safe %>
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
2021-12-01 18:16:45 +08:00
|
|
|
<% end %>
|
2022-06-10 16:41:57 +08:00
|
|
|
|
2021-12-01 18:16:45 +08:00
|
|
|
<% step.assets.where(view_mode: "inline").each do |asset| %>
|
|
|
|
<div class="print-asset inline">
|
|
|
|
<div class="print-asset-image">
|
2021-12-03 20:44:18 +08:00
|
|
|
<% if asset.previewable? %>
|
|
|
|
<%= image_tag asset.large_preview %>
|
|
|
|
<% end %>
|
|
|
|
<p><%= asset.render_file_name %></p>
|
2021-12-01 18:16:45 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-12-03 20:44:18 +08:00
|
|
|
<div class="page-break"></div>
|
2021-12-01 18:16:45 +08:00
|
|
|
<% end %>
|
|
|
|
<% step.assets.where(view_mode: "list").each do |asset| %>
|
|
|
|
<div class="print-asset list">
|
|
|
|
<span class="print-asset-icon"><%= file_extension_icon_html(asset) %></span>
|
2021-12-03 20:44:18 +08:00
|
|
|
<span><%= asset.render_file_name %></span>
|
2021-12-01 18:16:45 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<div class="print-thumbnails">
|
|
|
|
<% step.assets.where(view_mode: "thumbnail").each do |asset| %>
|
|
|
|
<div class="print-asset thumbnail">
|
|
|
|
<div class="print-asset-image">
|
2021-12-03 20:44:18 +08:00
|
|
|
<% if asset.previewable? %>
|
2023-06-01 22:18:15 +08:00
|
|
|
<%= image_tag asset.medium_preview %>
|
2021-12-03 20:44:18 +08:00
|
|
|
<% end %>
|
|
|
|
<p><%= asset.render_file_name %></p>
|
2021-12-01 18:16:45 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<% if params[:include_comments] && step.comments.present? %>
|
|
|
|
<div class="print-comments">
|
|
|
|
<h3><%= t('Comments') %>:</h3>
|
|
|
|
<% step.step_comments.each do |comment| %>
|
|
|
|
<div class="print-comment-container">
|
|
|
|
<div class="print-comment-header">
|
|
|
|
<%= image_tag avatar_path(comment.user, :icon_small), class: 'user-avatar' %>
|
|
|
|
<div class="user-name">
|
|
|
|
<%= comment.user.full_name %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="print-comment-body">
|
|
|
|
<div class="comment-message">
|
2021-12-03 20:44:18 +08:00
|
|
|
<%= smart_annotation_parser(comment.message, current_team).html_safe %>
|
2021-12-01 18:16:45 +08:00
|
|
|
</div>
|
|
|
|
<div class="print-comment-footer">
|
|
|
|
<div class="print-comment-create-date">
|
|
|
|
<%= I18n.l(comment.created_at, format: :full) %>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<hr>
|
2021-12-03 20:44:18 +08:00
|
|
|
<div class="page-break"></div>
|
2021-12-01 18:16:45 +08:00
|
|
|
<% end %>
|