2019-05-13 16:45:12 +08:00
|
|
|
<% preview = (defined?(preview) ? preview : false) %>
|
2019-06-27 19:10:28 +08:00
|
|
|
<% import = (defined?(import) ? import : false) %>
|
2020-10-31 01:47:01 +08:00
|
|
|
<div class ="step <%= "completed" if step.completed? %>" data-id="<%= step.id %>">
|
2016-07-21 19:11:15 +08:00
|
|
|
<div class="panel panel-default">
|
2020-05-15 17:04:17 +08:00
|
|
|
<div class="panel-heading step-heading">
|
2020-05-13 16:58:40 +08:00
|
|
|
<div class="left-floats">
|
2020-11-23 17:18:27 +08:00
|
|
|
<% if !import && !preview && @protocol.my_module %>
|
2020-11-18 16:57:50 +08:00
|
|
|
<button data-action="uncomplete-step"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
|
|
|
class="btn icon-btn btn-light toggle-step-complete
|
|
|
|
<%= 'hidden' unless step.completed? %>"
|
|
|
|
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
|
|
|
<span class="fas fa-check-circle"></span>
|
|
|
|
</button>
|
|
|
|
<button data-action="complete-step"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
|
|
|
class="btn icon-btn btn-light toggle-step-complete
|
|
|
|
<%= 'hidden' if step.completed? %>"
|
|
|
|
<%= 'disabled' if !can_complete_or_checkbox_step?(@protocol) || preview %>>
|
|
|
|
<span class="far fa-check-circle"></span>
|
|
|
|
</button>
|
|
|
|
<% end %>
|
2020-05-13 16:58:40 +08:00
|
|
|
<a class="step-panel-collapse-link"
|
|
|
|
href="#step-panel-<%= step.id || step.position %>"
|
|
|
|
data-toggle="collapse"
|
|
|
|
data-remote="true">
|
2020-09-04 20:43:30 +08:00
|
|
|
<span class="fas fa-caret-right"></span>
|
2020-05-13 16:58:40 +08:00
|
|
|
</a>
|
|
|
|
|
2020-07-13 20:51:51 +08:00
|
|
|
<span class="step-number"><%= step.position + 1 %>.</span>
|
2020-05-13 16:58:40 +08:00
|
|
|
|
|
|
|
<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"><%= sanitize_input t('protocols.steps.published_on',
|
|
|
|
timestamp: l(step.created_at, format: :full),
|
|
|
|
user: h(step.user.full_name)) %></span>
|
|
|
|
<% end %>
|
|
|
|
</a>
|
|
|
|
</div>
|
2020-10-31 01:47:01 +08:00
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
<div class="panel-options pull-right">
|
2020-09-29 21:08:01 +08:00
|
|
|
<% if !preview && @protocol.my_module %>
|
2020-10-31 01:47:01 +08:00
|
|
|
<button data-action="uncomplete-step"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
|
|
|
class="btn btn-secondary button-step-complete
|
|
|
|
<%= 'hidden' if !step.completed? || !can_complete_or_checkbox_step?(@protocol) || preview %>">
|
|
|
|
<span class="fas fa-undo"></span>
|
|
|
|
<%= t("protocols.steps.options.uncomplete_title") %>
|
|
|
|
</button>
|
|
|
|
<button data-action="complete-step"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>"
|
|
|
|
class="btn btn-secondary button-step-complete
|
|
|
|
<%= 'hidden' if step.completed? || !can_complete_or_checkbox_step?(@protocol) || preview %>">
|
|
|
|
<span class="far fa-check-circle"></span>
|
|
|
|
<%= t("protocols.steps.options.complete_title") %>
|
|
|
|
</button>
|
2019-03-25 20:53:28 +08:00
|
|
|
<% end %>
|
2020-07-27 22:14:14 +08:00
|
|
|
<% if (can_manage_protocol_in_module?(@protocol) || can_manage_protocol_in_repository?(@protocol)) && !(preview) %>
|
|
|
|
<%= link_to(move_up_step_path(step),
|
|
|
|
class: 'btn btn-light icon-btn',
|
|
|
|
title: t('protocols.steps.options.up_arrow_title'),
|
|
|
|
remote: true,
|
|
|
|
method: :put,
|
|
|
|
data: { action: 'move-step', direction: :up }) do %>
|
|
|
|
<span class="fas fa-arrow-up"></span>
|
|
|
|
<% end %>
|
|
|
|
<%= link_to(move_down_step_path(step),
|
|
|
|
class: 'btn btn-light icon-btn',
|
|
|
|
title: t('protocols.steps.options.down_arrow_title'),
|
|
|
|
remote: true,
|
|
|
|
method: :put,
|
|
|
|
data: { action: 'move-step', direction: :down }) do %>
|
|
|
|
<span class="fas fa-arrow-down"></span>
|
|
|
|
<% end %>
|
2020-09-07 19:49:11 +08:00
|
|
|
<%= link_to(edit_step_path(step),
|
|
|
|
title: t('protocols.steps.options.edit_title'),
|
|
|
|
class: 'btn btn-light icon-btn',
|
|
|
|
remote: true,
|
|
|
|
data: { action: 'edit-step' }) do %>
|
|
|
|
<span class="fas fa-pencil-alt"></span>
|
|
|
|
<% end %>
|
2020-07-27 22:14:14 +08:00
|
|
|
<%= link_to(step_path(step),
|
|
|
|
title: t('protocols.steps.options.delete_title'),
|
|
|
|
method: :delete,
|
|
|
|
class: 'btn btn-light icon-btn',
|
|
|
|
data: { action: 'delete-step', confirm: t('protocols.steps.destroy.confirm', step: step.name) }) do %>
|
2019-04-09 16:00:56 +08:00
|
|
|
<span class="fas fa-trash-alt"></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
</div>
|
2019-06-26 17:25:57 +08:00
|
|
|
<div class="panel-collapse collapse" id="step-panel-<%= step.id || step.position %>" role="tabpanel">
|
2016-09-16 15:04:21 +08:00
|
|
|
<div class="panel-body">
|
2016-07-21 19:11:15 +08:00
|
|
|
<div class="row">
|
2016-11-18 19:43:57 +08:00
|
|
|
<div class="col-xs-12">
|
2019-03-11 20:43:50 +08:00
|
|
|
<% if step.description.blank? %>
|
2017-01-03 23:35:25 +08:00
|
|
|
<em><%= t('protocols.steps.no_description') %></em>
|
2016-11-18 19:43:57 +08:00
|
|
|
<% else %>
|
|
|
|
<div class="ql-editor">
|
2019-03-22 17:52:26 +08:00
|
|
|
<%= custom_auto_link(step.tinymce_render(:description),
|
2017-04-19 15:11:52 +08:00
|
|
|
simple_format: false,
|
2018-11-19 15:02:25 +08:00
|
|
|
tags: %w(img),
|
|
|
|
team: current_team) %>
|
2016-09-29 20:37:29 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2016-11-18 19:43:57 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
2019-06-26 17:25:57 +08:00
|
|
|
<% if step.tables.any? %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<div class="col-xs-12">
|
2019-05-11 22:04:28 +08:00
|
|
|
<hr>
|
2017-01-17 00:11:08 +08:00
|
|
|
<% step.tables.each do |table| %>
|
|
|
|
<strong>
|
2017-01-25 18:01:35 +08:00
|
|
|
<%= auto_link(simple_format(table.name),
|
2017-01-17 00:11:08 +08:00
|
|
|
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 %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2017-01-11 21:13:48 +08:00
|
|
|
|
2019-06-27 19:10:28 +08:00
|
|
|
<% if import %>
|
|
|
|
<%= render partial: 'steps/attachments/preview_list.html.erb',
|
|
|
|
locals: { attachments: steps_assets[step.position]} %>
|
|
|
|
<% else %>
|
|
|
|
<%= render partial: 'steps/attachments/list.html.erb', locals: { step: step, preview: preview } %>
|
|
|
|
<% end %>
|
2016-07-21 19:11:15 +08:00
|
|
|
|
|
|
|
<% unless step.checklists.blank? then %>
|
|
|
|
<div class="col-xs-12">
|
2019-05-11 22:04:28 +08:00
|
|
|
<hr>
|
2017-05-04 21:17:34 +08:00
|
|
|
<% step.checklists.asc.each do |checklist| %>
|
2018-11-19 15:02:25 +08:00
|
|
|
<strong><%= custom_auto_link(checklist.name, team: current_team) %></strong>
|
2021-07-23 17:56:28 +08:00
|
|
|
<% if checklist.checklist_items.blank? %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</br>
|
|
|
|
<%= t("protocols.steps.empty_checklist") %>
|
|
|
|
</br>
|
|
|
|
<% else %>
|
|
|
|
<% ordered_checklist_items(checklist).each do |checklist_item| %>
|
|
|
|
<div class="checkbox" <%= @protocol.in_module? ? "data-action=check-item" : "" %>>
|
|
|
|
<label>
|
2021-11-24 16:36:53 +08:00
|
|
|
<% if @protocol.in_module? && can_complete_or_checkbox_step?(@protocol) %>
|
2017-01-03 23:35:25 +08:00
|
|
|
<input type="checkbox"
|
|
|
|
value=""
|
|
|
|
data-link-url="<%=checklistitem_state_step_path(step) %>"
|
|
|
|
data-id="<%= checklist_item.id %>" <%= "checked" if checklist_item.checked? %> />
|
2016-07-21 19:11:15 +08:00
|
|
|
<% else %>
|
2017-01-03 23:35:25 +08:00
|
|
|
<input type="checkbox"
|
|
|
|
value=""
|
2021-11-29 19:03:01 +08:00
|
|
|
disabled="disabled"
|
|
|
|
<%= "checked" if checklist_item.checked? %> />
|
2016-07-21 19:11:15 +08:00
|
|
|
<% end %>
|
2018-11-19 15:02:25 +08:00
|
|
|
<%= custom_auto_link(checklist_item.text, team: current_team) %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</label>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2019-06-27 19:10:28 +08:00
|
|
|
<% unless import %>
|
|
|
|
<hr>
|
|
|
|
<%= render partial: 'steps/comments.html.erb', locals: { comments: step.last_comments,
|
|
|
|
comments_count: step.step_comments.count,
|
|
|
|
step: step } %>
|
|
|
|
<% end %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|