mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2024-11-16 22:25:30 +08:00
143 lines
5.5 KiB
Text
143 lines
5.5 KiB
Text
<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>
|
|
|
|
<h1><%= @protocol.name || @protocol.my_module&.name %></h1>
|
|
<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>
|
|
<% @protocol.steps.order(position: :asc).each do |step| %>
|
|
<div class="print-step">
|
|
<h2 class="step-check-circle-checked">
|
|
<% if step.completed_on %>
|
|
<%= image_tag "check-circle-solid.svg" %>
|
|
<% else %>
|
|
<div class="step-check-circle"></div>
|
|
<% end %>
|
|
<%= step.position + 1 %>. <%= step.name %>
|
|
</h2>
|
|
|
|
<% 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">
|
|
<strong>
|
|
<%= auto_link(simple_format(step_text.name),
|
|
link: :urls,
|
|
html: { target: '_blank' }) %>
|
|
</strong>
|
|
<div class="page-break"></div>
|
|
<div class="ql-editor">
|
|
<%= custom_auto_link(step_text.tinymce_render(:text).gsub(/<p>\S<\/p>/, '').strip,
|
|
simple_format: false,
|
|
tags: %w(img),
|
|
team: current_team,
|
|
preview_repository: true) %>
|
|
</div>
|
|
</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") %>
|
|
<%= hidden_field(table, :metadata, value: table.metadata.to_json, class: "hot-metadata" ) %>
|
|
<div data-role="step-hot-table" class="step-result-hot-table"></div>
|
|
</div>
|
|
</div>
|
|
<% 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 %>
|
|
</span>
|
|
<div><%= smart_annotation_parser(checklist_item.text, current_team).html_safe %></div> <%# Should stay in one line %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
<% end %>
|
|
|
|
<% step.assets.where(view_mode: "inline").each do |asset| %>
|
|
<div class="print-asset inline">
|
|
<div class="print-asset-image">
|
|
<% if asset.previewable? %>
|
|
<%= image_tag asset.large_preview %>
|
|
<% end %>
|
|
<p><%= asset.render_file_name %></p>
|
|
</div>
|
|
</div>
|
|
<div class="page-break"></div>
|
|
<% 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>
|
|
<span><%= asset.render_file_name %></span>
|
|
</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">
|
|
<% if asset.previewable? %>
|
|
<%= image_tag asset.medium_preview %>
|
|
<% end %>
|
|
<p><%= asset.render_file_name %></p>
|
|
</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">
|
|
<%= smart_annotation_parser(comment.message, current_team).html_safe %>
|
|
</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>
|
|
<div class="page-break"></div>
|
|
<% end %>
|