2016-07-21 19:11:15 +08:00
|
|
|
<div class ="step <%= step.completed? ? "completed" : "not-completed" %>">
|
|
|
|
<div class="badge-num">
|
2018-05-08 22:33:42 +08:00
|
|
|
<span class="badge size-digit-<%= (step.position + 1).to_s.length %>"><%= step.position + 1 %></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
</div>
|
|
|
|
<div class="panel panel-default">
|
|
|
|
<div class="panel-heading">
|
|
|
|
<div class="panel-options pull-right">
|
2018-02-02 01:41:28 +08:00
|
|
|
<% if can_manage_protocol_in_module?(@protocol) ||
|
2018-02-16 01:46:29 +08:00
|
|
|
can_manage_protocol_in_repository?(@protocol) %>
|
2017-01-03 23:35:25 +08:00
|
|
|
<a data-action="move-step"
|
|
|
|
class="btn btn-link"
|
|
|
|
href="<%= move_up_step_path(step, format: :json) %>"
|
|
|
|
title="<%= t("protocols.steps.options.up_arrow_title") %>"
|
|
|
|
data-remote="true">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-arrow-up"></span></a>
|
2017-01-03 23:35:25 +08:00
|
|
|
<a data-action="move-step"
|
|
|
|
class="btn btn-link"
|
|
|
|
href="<%= move_down_step_path(step, format: :json) %>"
|
|
|
|
title="<%= t("protocols.steps.options.down_arrow_title") %>"
|
|
|
|
data-remote="true">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-arrow-down"></a>
|
2017-01-03 23:35:25 +08:00
|
|
|
<a data-action="edit-step"
|
2018-09-14 19:07:09 +08:00
|
|
|
class="btn btn-link help_tooltips"
|
2017-01-03 23:35:25 +08:00
|
|
|
title="<%= t("protocols.steps.options.edit_title") %>"
|
|
|
|
href="<%= edit_step_path(step, format: :json) %>"
|
2018-08-20 19:03:30 +08:00
|
|
|
data-remote="true"
|
2018-09-14 19:07:09 +08:00
|
|
|
data-tooltiplink="<%= I18n.t('tooltips.link.protocol.step_edit') %>"
|
|
|
|
data-tooltipcontent="<%= I18n.t('tooltips.text.protocol.step_edit') %>" >
|
2018-05-22 22:55:58 +08:00
|
|
|
<span class="fas fa-pencil-alt">
|
2016-07-21 19:11:15 +08:00
|
|
|
</a>
|
|
|
|
<%= link_to(step_path(step), title: t("protocols.steps.options.delete_title"), method: "delete", class: "btn btn-link",
|
|
|
|
data: {action: "delete-step", confirm: t("protocols.steps.destroy.confirm", step: step.name)}) do %>
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-trash-alt">
|
2016-07-21 19:11:15 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2017-01-03 23:35:25 +08:00
|
|
|
<a class="step-panel-collapse-link"
|
|
|
|
href="#step-panel-<%= step.id %>"
|
|
|
|
data-toggle="collapse"
|
|
|
|
data-remote="true">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-caret-square-down collapse-step-icon"></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
<strong><%= step.name %></strong> |
|
2017-03-10 23:21:43 +08:00
|
|
|
<span><%= sanitize_input t('protocols.steps.published_on',
|
|
|
|
timestamp: l(step.created_at, format: :full),
|
|
|
|
user: h(step.user.full_name)) %></span>
|
2016-07-21 19:11:15 +08:00
|
|
|
</a>
|
|
|
|
</div>
|
|
|
|
<div class="panel-collapse collapse" id="step-panel-<%= step.id %>" 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">
|
|
|
|
<% if strip_tags(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">
|
2017-10-03 00:06:42 +08:00
|
|
|
<%= custom_auto_link(generate_image_tag_from_token(step.description, step),
|
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">
|
|
|
|
<hr>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% unless step.tables.blank? then %>
|
|
|
|
<div class="col-xs-12">
|
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
|
|
|
|
2016-07-21 19:11:15 +08:00
|
|
|
<% assets = ordered_assets(step) %>
|
|
|
|
<% unless assets.blank? then %>
|
|
|
|
<div class="col-xs-12">
|
|
|
|
<strong><%= t("protocols.steps.files") %></strong>
|
|
|
|
<ul>
|
|
|
|
<% assets.each do |asset| %>
|
|
|
|
<li>
|
2018-04-12 19:40:17 +08:00
|
|
|
<%= render partial: "shared/asset_link", locals: { asset: asset, display_image_tag: true }, formats: :html %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</li>
|
|
|
|
<% end %>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
|
|
|
|
<% unless step.checklists.blank? then %>
|
|
|
|
<div class="col-xs-12">
|
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>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% if checklist.checklist_items.empty? %>
|
|
|
|
</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>
|
|
|
|
<% if @protocol.in_module? %>
|
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=""
|
|
|
|
disabled="disabled" />
|
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 %>
|
|
|
|
|
2018-02-09 23:14:40 +08:00
|
|
|
<% if can_complete_or_checkbox_step?(@protocol) %>
|
|
|
|
<% if step.completed? %>
|
|
|
|
<div data-action="uncomplete-step"
|
2017-01-03 23:35:25 +08:00
|
|
|
class="pull-right"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>">
|
2018-05-08 22:33:42 +08:00
|
|
|
<button class="btn btn-default">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-times"></span>
|
2018-05-08 22:33:42 +08:00
|
|
|
<%= t("protocols.steps.options.uncomplete_title") %>
|
|
|
|
</button>
|
2016-09-29 20:37:29 +08:00
|
|
|
</div>
|
2018-02-09 23:14:40 +08:00
|
|
|
<% else %>
|
|
|
|
<div data-action="complete-step"
|
2017-01-03 23:35:25 +08:00
|
|
|
class="pull-right"
|
|
|
|
data-link-url="<%= toggle_step_state_step_path(step)%>">
|
2018-05-18 22:24:24 +08:00
|
|
|
<button class="btn btn-toggle">
|
2018-07-09 19:13:44 +08:00
|
|
|
<span class="fas fa-check"></span>
|
2018-05-08 22:33:42 +08:00
|
|
|
<%= t("protocols.steps.options.complete_title") %>
|
|
|
|
</button>
|
2016-09-29 20:37:29 +08:00
|
|
|
</div>
|
|
|
|
<% end %>
|
2016-07-21 19:11:15 +08:00
|
|
|
<% end %>
|
|
|
|
</div>
|
2016-09-29 20:37:29 +08:00
|
|
|
|
2018-02-02 01:41:28 +08:00
|
|
|
<% if can_read_protocol_in_module?(@protocol) %>
|
2016-09-16 15:04:21 +08:00
|
|
|
<div class="row">
|
2016-09-21 00:53:51 +08:00
|
|
|
<div class="step-comment"
|
|
|
|
id="step-comments-<%= step.id %>"
|
|
|
|
data-href="<%= url_for step_step_comments_path(step_id: step.id, format: :json) %>">
|
2018-11-13 23:57:42 +08:00
|
|
|
<%= render partial: "step_comments/index.html.erb",
|
|
|
|
locals: { step: step, comments: step.last_comments, per_page: Constants::COMMENTS_SEARCH_LIMIT } %>
|
2016-09-16 15:04:21 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
2016-09-29 20:37:29 +08:00
|
|
|
<% end %>
|
2016-07-21 19:11:15 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|