2023-01-20 21:29:25 +08:00
|
|
|
<div class="modal" id="protocol-versions-modal" class="protocol-versions-modal" tabindex="-1" role="dialog" aria-labelledby="protocol-versions-modal-label">
|
|
|
|
<div class="modal-dialog" role="document">
|
|
|
|
<div class="modal-content">
|
|
|
|
<div class="modal-header">
|
2023-08-17 19:55:17 +08:00
|
|
|
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><i class="sn-icon sn-icon-close"></i></button>
|
2023-01-20 21:29:25 +08:00
|
|
|
<h4 class="modal-title" id="protocol-versions-modal-label">
|
|
|
|
<%= t('protocols.index.versions.title', protocol: @protocol.name) %>
|
|
|
|
</h4>
|
|
|
|
</div>
|
|
|
|
<div class="modal-body">
|
2023-03-02 23:10:28 +08:00
|
|
|
<% if @protocol.initial_draft? || @protocol.draft.present? %>
|
|
|
|
<% draft = @protocol.initial_draft? ? @protocol : @protocol.draft %>
|
2023-01-26 19:39:11 +08:00
|
|
|
<div class="protocol-version-row">
|
2023-03-27 19:28:00 +08:00
|
|
|
<div class="protocol-version-metadata">
|
|
|
|
<div class="protocol-link">
|
|
|
|
<%= link_to protocol_path(draft) do %>
|
|
|
|
<% if draft.previous_version %>
|
|
|
|
<%= t('protocols.index.versions.draft_html', parent_version: draft.previous_version.version_number) %>
|
|
|
|
<% else %>
|
|
|
|
<%= t('protocols.index.versions.first_draft_html') %>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<div class="protocol-metadata">
|
|
|
|
<% if draft.last_modified_by.present? %>
|
|
|
|
<%= t('protocols.index.versions.draft_full_modification_info',
|
|
|
|
modified_on: draft.updated_at.present? ? l(draft.updated_at, format: :full_date) : '',
|
|
|
|
modified_by: draft.last_modified_by&.full_name) %>
|
2023-02-24 22:32:10 +08:00
|
|
|
<% else %>
|
2023-03-27 19:28:00 +08:00
|
|
|
<%= t('protocols.index.versions.draft_update_modification_info',
|
|
|
|
modified_on: draft.updated_at.present? ? l(draft.updated_at, format: :full_date) : '') %>
|
|
|
|
<%end%>
|
|
|
|
</div>
|
|
|
|
<div class="protocol-actions">
|
|
|
|
<% if can_publish_protocol_in_repository?(draft) %>
|
2024-01-26 22:22:18 +08:00
|
|
|
<%= button_to publish_protocol_path(draft),
|
|
|
|
params: { view: 'show' },
|
|
|
|
class: 'btn btn-light publish-draft',
|
|
|
|
method: :post do %>
|
2023-03-27 19:28:00 +08:00
|
|
|
<%= image_tag 'icon_small/publish.svg' %>
|
|
|
|
<%= t('protocols.index.versions.publish') %>
|
|
|
|
<% end %>
|
2023-02-24 22:32:10 +08:00
|
|
|
<% end %>
|
2023-03-27 19:28:00 +08:00
|
|
|
<% if can_delete_protocol_draft_in_repository?(draft) %>
|
|
|
|
<div data-url="<%= destroy_draft_protocol_path(draft) %>" class="btn btn-light delete-draft">
|
2023-06-08 14:33:37 +08:00
|
|
|
<i class="sn-icon sn-icon-delete"></i>
|
2023-03-27 19:28:00 +08:00
|
|
|
</div>
|
2023-03-01 18:44:22 +08:00
|
|
|
<% end %>
|
2023-03-27 19:28:00 +08:00
|
|
|
</div>
|
2023-01-26 19:39:11 +08:00
|
|
|
</div>
|
|
|
|
<div class="protocol-version-comment">
|
2023-04-11 18:50:14 +08:00
|
|
|
<% if can_manage_protocol_draft_in_repository?(draft) && can_publish_protocol_in_repository?(draft) %>
|
2023-01-26 19:39:11 +08:00
|
|
|
<div
|
|
|
|
class="protocol-comment-container inline-init-handler"
|
|
|
|
data-field-to-update="version_comment"
|
|
|
|
data-params-group="protocol"
|
2023-02-24 22:32:10 +08:00
|
|
|
data-path-to-update="<%= update_version_comment_protocol_path(draft) %>"
|
|
|
|
data-original-name="<%= draft.version_comment %>"
|
2023-01-26 19:39:11 +08:00
|
|
|
data-response-field="version_comment"
|
|
|
|
data-edit-mode="0"
|
|
|
|
>
|
2023-03-20 18:46:01 +08:00
|
|
|
<div class="protocol-comment-message sci-input-container">
|
2023-02-24 22:32:10 +08:00
|
|
|
<div class="view-mode" data-placeholder="<%= t('protocols.index.versions.comment_placeholder') %>"><%= draft.version_comment %></div>
|
2023-03-22 18:32:49 +08:00
|
|
|
<%= text_area_tag 'version_comment', draft.version_comment, disabled: true, class: 'smart-text-area hidden sci-input-field' %>
|
2023-01-26 19:39:11 +08:00
|
|
|
</div>
|
|
|
|
<div class="edit-buttons">
|
|
|
|
<span class="cancel-button btn btn-secondary"><%= t('general.cancel') %></span>
|
|
|
|
<span class="save-button btn btn-primary"><%= t('general.save') %></span>
|
|
|
|
</div>
|
2023-01-20 21:29:25 +08:00
|
|
|
</div>
|
2023-01-26 19:39:11 +08:00
|
|
|
<% else %>
|
2023-02-24 22:32:10 +08:00
|
|
|
<%= draft.version_comment %>
|
2023-01-26 19:39:11 +08:00
|
|
|
<% end %>
|
2023-01-20 21:29:25 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% @published_versions.each do |protocol_version| %>
|
2023-01-26 19:39:11 +08:00
|
|
|
<div class="protocol-version-row">
|
2023-03-27 19:28:00 +08:00
|
|
|
<div class="protocol-version-metadata">
|
|
|
|
<div class="protocol-link">
|
|
|
|
<%= link_to protocol_path(protocol_version) do %>
|
|
|
|
<b><%= t('protocols.index.versions.revision', version: protocol_version.version_number) %></b>
|
2023-02-22 21:59:48 +08:00
|
|
|
<% end %>
|
2023-03-27 19:28:00 +08:00
|
|
|
</div>
|
|
|
|
<div class="protocol-metadata">
|
|
|
|
<%= t('protocols.index.versions.revision_publishing_info',
|
|
|
|
published_on: protocol_version.published_on.present? ? l(protocol_version.published_on, format: :full_date) : '',
|
|
|
|
published_by: protocol_version.published_by&.full_name) %>
|
|
|
|
</div>
|
|
|
|
<div class="protocol-actions">
|
|
|
|
<% if can_save_protocol_version_as_draft?(@protocol) %>
|
|
|
|
<%= button_to save_as_draft_protocol_path(protocol_version),
|
|
|
|
class: "btn btn-light icon-btn save-as-draft",
|
|
|
|
title: t('protocols.index.versions.save_as_draft'),
|
|
|
|
disabled: @protocol.draft.present?,
|
2023-06-21 20:13:20 +08:00
|
|
|
method: :post,
|
2023-03-27 19:28:00 +08:00
|
|
|
data: {
|
|
|
|
placement: :left,
|
|
|
|
toggle: :tooltip
|
|
|
|
} do %>
|
2023-06-08 14:33:37 +08:00
|
|
|
<i class="sn-icon sn-icon-duplicate"></i>
|
2023-03-27 19:28:00 +08:00
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
2023-01-26 19:39:11 +08:00
|
|
|
</div>
|
|
|
|
<div class="protocol-version-comment">
|
|
|
|
<%= protocol_version.version_comment %>
|
2023-01-20 21:29:25 +08:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<div class="modal-footer"></div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|