scinote-web/app/views/steps/_step.html.erb
2023-06-21 14:38:32 +02:00

109 lines
4.4 KiB
Text

<% preview = (defined?(preview) ? preview : false) %>
<% import = (defined?(import) ? import : false) %>
<div class ="step <%= "completed" if step.completed? %>" data-id="<%= step.id %>">
<div class="panel panel-default">
<div class="panel-heading step-heading">
<div class="left-floats">
<a class="step-panel-collapse-link"
href="#step-panel-<%= step.id || step.position %>"
data-toggle="collapse"
data-remote="true">
<span class="sn-icon sn-icon-right"></span>
</a>
<span class="step-number"><%= step.position + 1 %>.</span>
<a class="step-panel-collapse-link step-name-link"
href="#step-panel-<%= step.id || step.position %>"
data-toggle="collapse"
data-remote="true">
<span class="name-block"><strong><%= step.name %></strong></span>
<% unless step.new_record? %>
<span class="delimiter">|</span>
<span class="author-block">
<%= t('protocols.steps.published_on_html', timestamp: l(step.created_at, format: :full), user: step.user.full_name) %>
</span>
<% end %>
</a>
</div>
<div class="panel-options pull-right">
</div>
</div>
<div class="panel-collapse collapse" id="step-panel-<%= step.id || step.position %>" role="tabpanel">
<div class="panel-body">
<div class="row">
<div class="col-xs-12">
<% if step.description.blank? %>
<em><%= t('protocols.steps.no_description') %></em>
<% else %>
<div class="ql-editor">
<%= custom_auto_link(step.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team) %>
</div>
<% end %>
</div>
</div>
<div class="row">
<% if step.tables.any? %>
<div class="col-xs-12">
<hr>
<% step.tables.each do |table| %>
<strong>
<%= auto_link(simple_format(table.name),
link: :urls,
html: { target: '_blank' }) %>
</strong>
<div data-role="hot-table" class="hot-table">
<%= hidden_field(table, :contents, value: table.contents_utf_8, class: "hot-contents") %>
<div data-role="step-hot-table" class="step-result-hot-table"></div>
</div>
<% end %>
</div>
<% end %>
<% if import %>
<%= render partial: 'steps/attachments/preview_list',
locals: { attachments: steps_assets[step.position]} %>
<% else %>
<%= render partial: 'steps/attachments/list', locals: { step: step, preview: preview } %>
<% end %>
<% unless step.checklists.blank? then %>
<div class="col-xs-12">
<hr>
<% step.checklists.asc.each do |checklist| %>
<strong><%= custom_auto_link(checklist.name, team: current_team) %></strong>
<% if checklist.checklist_items.blank? %>
</br>
<%= t("protocols.steps.empty_checklist") %>
</br>
<% else %>
<% ordered_checklist_items(checklist).each do |checklist_item| %>
<div class="checkbox">
<label>
<input type="checkbox"
value=""
disabled="disabled"
<%= "checked" if checklist_item.checked? %> />
<%= custom_auto_link(checklist_item.text, team: current_team) %>
</label>
</div>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
</div>
<% unless import %>
<hr>
<%= render partial: 'steps/comments', locals: { comments: step.last_comments,
comments_count: step.step_comments.count,
step: step } %>
<% end %>
</div>
</div>
</div>
</div>