scinote-web/app/views/steps/_step.html.erb
aignatov-bio 71b3228310
Update protocol preview style [SCI-3416] (#1729)
* Update protocol appearance
2019-05-13 10:45:12 +02:00

155 lines
6.9 KiB
Text

<% preview = (defined?(preview) ? preview : false) %>
<div class ="step <%= step.completed? ? "completed" : "not-completed" %>">
<div class="panel panel-default">
<div class="panel-heading">
<div class="panel-options pull-right">
<% if can_complete_or_checkbox_step?(@protocol) && !(preview) %>
<% if step.completed? %>
<div data-action="uncomplete-step"
class="complete-step-btn"
data-link-url="<%= toggle_step_state_step_path(step)%>">
<button class="btn btn-default">
<span class="fas fa-times"></span>
<%= t("protocols.steps.options.uncomplete_title") %>
</button>
</div>
<% else %>
<div data-action="complete-step"
class="complete-step-btn"
data-link-url="<%= toggle_step_state_step_path(step)%>">
<button class="btn btn-toggle">
<span class="fas fa-check"></span>
<%= t("protocols.steps.options.complete_title") %>
</button>
</div>
<% end %>
<% end %>
<% if (can_manage_protocol_in_module?(@protocol) ||
can_manage_protocol_in_repository?(@protocol)) && !(preview) %>
<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">
<span class="fas fa-arrow-up"></span></a>
<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">
<span class="fas fa-arrow-down"></span></a>
<a data-action="edit-step"
class="btn btn-link help_tooltips"
title="<%= t("protocols.steps.options.edit_title") %>"
href="<%= edit_step_path(step, format: :json) %>"
data-remote="true"
data-tooltiplink="<%= I18n.t('tooltips.link.protocol.step_edit') %>"
data-tooltipcontent="<%= I18n.t('tooltips.text.protocol.step_edit') %>" >
<span class="fas fa-pencil-alt"></span>
</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 %>
<span class="fas fa-trash-alt"></span>
<% end %>
<% end %>
</div>
<div class="left-floats">
<a class="step-panel-collapse-link"
href="#step-panel-<%= step.id %>"
data-toggle="collapse"
data-remote="true">
<span class="fas fa-caret-square-down collapse-step-icon"></span>
</a>
<span class="step-number"><%= step.position + 1 %></span>
<a class="step-panel-collapse-link step-name-link"
href="#step-panel-<%= step.id %>"
data-toggle="collapse"
data-remote="true">
<span class="name-block"><strong><%= step.name %></strong></span>
<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>
</a>
</div>
</div>
<div class="panel-collapse collapse" id="step-panel-<%= step.id %>" 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">
<% unless step.tables.blank? then %>
<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 %>
<%= render partial: 'steps/attachments/list.html.erb', locals: { step: step, preview: preview } %>
<% 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.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? %>
<input type="checkbox"
value=""
data-link-url="<%=checklistitem_state_step_path(step) %>"
data-id="<%= checklist_item.id %>" <%= "checked" if checklist_item.checked? %> />
<% else %>
<input type="checkbox"
value=""
disabled="disabled" />
<% end %>
<%= custom_auto_link(checklist_item.text, team: current_team) %>
</label>
</div>
<% end %>
<% end %>
<% end %>
</div>
<% end %>
</div>
<hr>
<%= render partial: 'steps/comments.html.erb', locals: { comments: step.last_comments,
comments_count: step.step_comments.count,
step: step } %>
</div>
</div>
</div>
</div>