Clean old protocol code [SCI-8154]

This commit is contained in:
Anton 2023-03-16 14:04:25 +01:00
parent 7c287b3993
commit da36b7268f
19 changed files with 0 additions and 707 deletions

View file

@ -638,41 +638,6 @@ var ProtocolsIndex = (function() {
}
function initModals() {
function refresh(modal) {
modal.find('.modal-body').html('');
// Simply re-render table
reloadTable();
}
// Make private modal hidden action
$('#make-private-results-modal').on('hidden.bs.modal', function() {
refresh($(this));
updateDataTableSelectAllCheckbox();
updateButtons();
});
// Publish modal hidden action
$('#publish-results-modal').on('hidden.bs.modal', function() {
refresh($(this));
updateDataTableSelectAllCheckbox();
updateButtons();
});
// Confirm archive modal hidden action
$('#confirm-archive-modal').on('hidden.bs.modal', function() {
// Unbind from click event on the submit button
$(this).find(".modal-footer [data-action='submit']")
.off('click');
});
// Archive modal hidden action
$('#archive-results-modal').on('hidden.bs.modal', function() {
refresh($(this));
updateDataTableSelectAllCheckbox();
updateButtons();
});
// Linked children modal close action
$('#linked-children-modal').on('hidden.bs.modal', function() {
$(this).find('.modal-title').html('');
@ -680,13 +645,6 @@ var ProtocolsIndex = (function() {
$(this).find('.modal-body #linked-children-table').DataTable().destroy();
$(this).find('.modal-body').html('');
});
// Protocol preview modal close action
$('#protocol-preview-modal').on('hidden.bs.modal', function() {
$(this).find('.modal-title').html('');
$(this).find('.modal-body').html('');
$(this).find('.modal-footer').html('');
});
}
function updateDataTableSelectAllCheckbox() {
@ -734,235 +692,7 @@ var ProtocolsIndex = (function() {
actionToolbar.find('.emptyPlaceholder').toggleClass('hidden', actionToolbar.find('.btn:visible').length > 0);
}
/*
function updateButtons() {
var cloneBtn = $("[data-action='clone']");
var makePrivateBtn = $("[data-action='make-private']");
var publishBtn = $("[data-action='publish']");
var archiveBtn = $("[data-action='archive']");
var restoreBtn = $("[data-action='restore']");
var exportBtn = $("[data-action='export']");
var row = $("tr[data-row-id='" + rowsSelected[0] + "']");
var rows = [];
if (rowsSelected.length === 1) {
// 1 ROW SELECTED
if (row.is('[data-can-clone]')) {
cloneBtn.removeClass('disabled hidden');
cloneBtn.off('click').on('click', function() { cloneSelectedProtocol(); });
} else {
cloneBtn.removeClass('hidden').addClass('disabled');
cloneBtn.off('click');
}
if (row.is('[data-can-make-private]')) {
makePrivateBtn.removeClass('disabled hidden');
makePrivateBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
makePrivateBtn.removeClass('hidden').addClass('disabled');
makePrivateBtn.off('click');
}
if (row.is('[data-can-publish]')) {
publishBtn.removeClass('disabled hidden');
publishBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
publishBtn.removeClass('hidden').addClass('disabled');
publishBtn.off('click');
}
if (row.is('[data-can-archive]')) {
archiveBtn.removeClass('disabled hidden');
archiveBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
archiveBtn.removeClass('hidden').addClass('disabled');
archiveBtn.off('click');
}
if (row.is('[data-can-restore]')) {
restoreBtn.removeClass('disabled hidden');
restoreBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
restoreBtn.removeClass('hidden').addClass('disabled');
restoreBtn.off('click');
}
if (row.is('[data-can-export]')) {
exportBtn.removeClass('disabled hidden');
exportBtn.off('click').on('click', function() { exportProtocols(rowsSelected); });
} else {
exportBtn.removeClass('hidden').addClass('disabled');
exportBtn.off('click');
}
} else if (rowsSelected.length === 0) {
// 0 ROWS SELECTED
cloneBtn.addClass('disabled hidden');
cloneBtn.off('click');
makePrivateBtn.addClass('disabled hidden');
makePrivateBtn.off('click');
publishBtn.addClass('disabled hidden');
publishBtn.off('click');
archiveBtn.addClass('disabled hidden');
archiveBtn.off('click');
restoreBtn.addClass('disabled hidden');
restoreBtn.off('click');
exportBtn.addClass('disabled hidden');
exportBtn.off('click');
} else {
// > 1 ROWS SELECTED
_.each(rowsSelected, function(rowId) {
rows.push($("tr[data-row-id='" + rowId + "']")[0]);
});
rows = $(rows);
// Only enable button if all selected rows can
// be published/archived/restored/exported
cloneBtn.removeClass('hidden').addClass('disabled');
cloneBtn.off('click');
if (!rows.is(':not([data-can-make-private])')) {
makePrivateBtn.removeClass('disabled hidden');
makePrivateBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
makePrivateBtn.removeClass('hidden').addClass('disabled');
makePrivateBtn.off('click');
}
if (!rows.is(':not([data-can-publish])')) {
publishBtn.removeClass('disabled hidden');
publishBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
publishBtn.removeClass('hidden').addClass('disabled');
publishBtn.off('click');
}
if (!rows.is(':not([data-can-archive])')) {
archiveBtn.removeClass('disabled hidden');
archiveBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
archiveBtn.removeClass('hidden').addClass('disabled');
archiveBtn.off('click');
}
if (!rows.is(':not([data-can-restore])')) {
restoreBtn.removeClass('disabled hidden');
restoreBtn.off('click').on('click', function() { processMoveButtonClick($(this)); });
} else {
restoreBtn.removeClass('hidden').addClass('disabled');
restoreBtn.off('click');
}
if (!rows.is(':not([data-can-export])')) {
exportBtn.removeClass('disabled hidden');
exportBtn.off('click').on('click', function() { exportProtocols(rowsSelected); });
} else {
exportBtn.removeClass('hidden').addClass('disabled');
exportBtn.off('click');
}
}
}
*/
/*
function exportProtocols(ids) {
if (ids.length > 0) {
var params = '?protocol_ids[]=' + ids[0];
for (var i = 1; i < ids.length; i++) {
params += '&protocol_ids[]=' + ids[i];
}
params = encodeURI(params);
window.location.href = $("[data-action='export']")
.data('export-url') + params;
}
}
function cloneSelectedProtocol() {
if (rowsSelected.length && rowsSelected.length == 1) {
var row = $("tr[data-row-id='" + rowsSelected[0] + "']");
animateSpinner();
$.ajax({
url: row.attr("data-clone-url"),
type: "POST",
dataType: "json",
success: function (data) {
animateSpinner(null, false);
// Reload page
location.reload();
},
error: function (error) {
animateSpinner(null, false);
// Reload page
location.reload();
}
});
}
}
function processMoveButtonClick(btn) {
var action = btn.attr("data-action");
var url = btn.attr("data-url");
if (action === "archive") {
confirmModal = $("#confirm-archive-modal");
confirmModal
.find(".modal-footer [data-action='submit']")
.on("click", function(e) {
confirmModal.modal("hide");
moveSelectedProtocols(action, url);
});
// Show the modal
confirmModal.modal("show");
} else {
moveSelectedProtocols(action, url);
}
}
function moveSelectedProtocols(action, url) {
animateSpinner();
$.ajax({
url: url,
type: "POST",
dataType: "json",
data: { protocol_ids: rowsSelected },
success: function (data) {
rowsSelected = [];
// Display the modal
var modal = $("#" + action + "-results-modal");
var modalBody = modal.find(".modal-body");
modalBody.html(data.html);
animateSpinner(null, false);
modal.modal("show");
},
error: function (error) {
animateSpinner(null, false);
if (error.status == 401) {
// Unauthorized
alert(I18n.t("protocols.index." + action.replace("-", "_") + "_unauthorized"));
} else {
// Generic error
alert(I18n.t("protocols.index." + action.replace("-", "_") + "_error"));
}
}
});
}
*/
function initLocalFileImport() {
// Some templating code duplication. I know, I hate myself
function newElement(name, values) {
var template = $("[data-template='" + name + "']").clone();
template.removeAttr('data-template');
template.show();
// Populate values in the template
if (values !== null) {
_.each(values, function(val, key) {
template.find("[data-val='" + key + "']").html(val);
});
}
return template;
}
function addChildToElement(parentEl, name, childEl) {
parentEl.find("[data-hold='" + name + "']").append(childEl);
}
let fileInput = $("[data-role='import-file-input']");

View file

@ -17,8 +17,6 @@ class ProtocolsController < ApplicationController
show
versions_modal
protocol_status_bar
updated_at_label
preview
linked_children
linked_children_datatable
permissions
@ -37,10 +35,6 @@ class ProtocolsController < ApplicationController
update_version_comment
update_name
update_authors
edit_name_modal
edit_keywords_modal
edit_authors_modal
edit_description_modal
unlink
unlink_modal
revert
@ -96,25 +90,6 @@ class ProtocolsController < ApplicationController
end
end
def preview
respond_to do |format|
format.json do
render json: {
title: I18n.t('protocols.index.preview.title',
protocol: escape_input(@protocol.name)),
html: render_to_string(
partial: 'protocols/index/protocol_preview_modal_body.html.erb',
locals: { protocol: @protocol }
),
footer: render_to_string(
partial: 'protocols/index/protocol_preview_modal_footer.html.erb',
locals: { protocol: @protocol }
)
}
end
end
end
def versions_modal
return render_403 unless @protocol.in_repository_published_original? || @protocol.initial_draft?
@ -156,10 +131,6 @@ class ProtocolsController < ApplicationController
end
end
def make_private
move_protocol('make_private')
end
def publish
Protocol.transaction do
@protocol.update!(
@ -933,75 +904,6 @@ class ProtocolsController < ApplicationController
end
end
def updated_at_label
respond_to do |format|
format.json do
render json: {
html: render_to_string({
partial: "protocols/header/updated_at_label.html.erb"
})
}
end
end
end
def edit_name_modal
respond_to do |format|
format.json do
render json: {
title: I18n.t('protocols.header.edit_name_modal.title',
protocol: escape_input(@protocol.name)),
html: render_to_string({
partial: "protocols/header/edit_name_modal_body.html.erb"
})
}
end
end
end
def edit_keywords_modal
respond_to do |format|
format.json do
render json: {
title: I18n.t('protocols.header.edit_keywords_modal.title',
protocol: escape_input(@protocol.name)),
html: render_to_string({
partial: "protocols/header/edit_keywords_modal_body.html.erb"
}),
keywords: @protocol.team.protocol_keywords_list
}
end
end
end
def edit_authors_modal
respond_to do |format|
format.json do
render json: {
title: I18n.t('protocols.header.edit_authors_modal.title',
protocol: escape_input(@protocol.name)),
html: render_to_string({
partial: "protocols/header/edit_authors_modal_body.html.erb"
})
}
end
end
end
def edit_description_modal
respond_to do |format|
format.json do
render json: {
title: I18n.t('protocols.header.edit_description_modal.title',
protocol: escape_input(@protocol.name)),
html: render_to_string({
partial: "protocols/header/edit_description_modal_body.html.erb"
})
}
end
end
end
def update_version_comment
respond_to do |format|
format.json do

View file

@ -1,57 +0,0 @@
<div class="protocol-repository-header">
<% unless preview %>
<h1 class="page-header repository-protocol-name">
<%= render partial: "protocols/header/name_label.html.erb" %>
</h1>
<% end %>
<div class="protocol-info">
<div class="created-at-block">
<span class="fas block-icon fa-calendar-alt"></span>
<span class="hidden-xs hidden-sm hidden-md"><%=t "protocols.header.created_at" %>:</span>
<b><%= l(@protocol.created_at, format: :full) %></b>
</div>
<div class="last-modified-block">
<span class="fas block-icon fa-calendar-alt"></span>
<span class="hidden-xs hidden-sm hidden-md"><%=t "protocols.header.updated_at" %>:</span>
<b data-role="updated-at-refresh"><%= render partial: "protocols/header/updated_at_label.html.erb" %></b>
</div>
<div class="added-by-block">
<span class="fas block-icon fa-user"></span>
<span class="hidden-xs hidden-sm hidden-md"><%=t "protocols.header.added_by" %>:</span>
<b><%= @protocol.added_by.full_name %></b>
</div>
<div class="edit-authors-block">
<div class="block-label">
<span class="fas block-icon fa-graduation-cap"></span>
<span class="hidden-xs hidden-sm hidden-md"><%=t "protocols.header.authors" %>:</span>
</div>
<div class="edit-authors-container">
<%= render partial: "protocols/header/authors_label.html.erb", locals: {editable: !preview} %>
</div>
</div>
<div class="keywords-block">
<div class="block-label">
<span class="fas block-icon fa-font"></span>
<span class="hidden-xs hidden-sm hidden-md"><%=t "protocols.header.keywords" %>:</span>
</div>
<div class="key-words-container">
<%= select_tag "keyword-input-field", options_for_select(@protocol.protocol_keywords.map{|i| i.name}),{
'data-placeholder': t("protocols.no_keywords"),
'data-update-url': keywords_protocol_path(@protocol, format: :json),
'data-view-mode': !can_manage_protocol_in_repository?(@protocol) || preview,
class: 'hidden'
} %>
</div>
</div>
<div class="protocol-description">
<%= render partial: "protocols/header/description_label.html.erb", locals: {edit_mode: !preview} %>
</div>
</div>
</div>

View file

@ -1,38 +0,0 @@
<div class="row">
<div class="expand-all-steps" style="display: <%= 'none' if @protocol.steps.blank? %>">
<a class="btn btn-light" data-action="collapse-steps">
<span class="fas fa-caret-up"></span>
<span><%= t("protocols.steps.collapse_label") %></a></span>
<a class="btn btn-light" data-action="expand-steps">
<span class="fas fa-caret-down"></span>
<span><%= t("protocols.steps.expand_label") %></a></span>
</div>
</div>
<div id="steps">
<% @protocol.steps.order(:position).each do |step| %>
<%= render partial: "steps/step.html.erb", locals: { step: step } %>
<% end %>
</div>
<% if can_manage_protocol_in_module?(@protocol) || can_manage_protocol_in_repository?(@protocol) %>
<div class="row">
<div class="pull-left" style="margin: 0 0 20px 15px;">
<a href="#"
class="btn btn-primary"
data-action="new-step"
data-href="<%= new_protocol_step_path(protocol_id: @protocol.id, format: :json) %>">
<span class="fas fa-plus" aria-hidden="true"></span>
<span class="hidden-xs"><%=t "protocols.steps.new_step" %></span>
</a>
</div>
</div>
<% end %>
<%= javascript_include_tag "handsontable.full" %>
<!-- Libraries for formulas -->
<%= render partial: "shared/formulas_libraries.html.erb" %>
<%= javascript_include_tag "assets/wopi/create_wopi_file" %>
<%= javascript_include_tag "protocols/steps" %>
<%= render partial: "shared/bio_eddie_modal.html.erb" %>

View file

@ -1,19 +0,0 @@
<% provide(:head_title, t("protocols.edit.head_title")) %>
<%= render partial: 'shared/drag_n_drop_overlay' %>
<div class="content-pane protocols-repository-edit-view">
<%= render partial: "protocols/header.html.erb", locals: {preview: false} %>
<%= render partial: "protocols/steps.html.erb" %>
<div class="hidden" data-role="updated-at-label-url" data-url="<%= updated_at_label_protocol_path(@protocol) %>"></div>
</div>
<%= javascript_include_tag "protocols/edit" %>
<!-- Create new office file modal -->
<%= render partial: 'assets/wopi/create_wopi_file_modal.html.erb' %>
<!-- Delete file modal -->
<%= render partial: 'assets/asset_delete_modal.html.erb' %>
<%= javascript_pack_tag 'pdfjs/pdf_js' %>
<%= stylesheet_pack_tag 'pdfjs/pdf_js_styles' %>

View file

@ -1,15 +0,0 @@
<% if can_manage_protocol_in_repository?(@protocol) && editable %>
<%= render partial: "shared/inline_editing.html.erb",
locals: {
initial_value: @protocol.authors,
config: {
field_to_udpate: 'authors',
params_group: 'protocol',
placeholder: t("protocols.header.no_authors"),
path_to_update: authors_protocol_path(@protocol)
}
}
%>
<% else %>
<span class="view-mode"><%= @protocol.authors || t("protocols.header.no_authors") %></span>
<% end %>

View file

@ -1,15 +0,0 @@
<% if can_manage_protocol_in_repository?(@protocol) && edit_mode %>
<%= render partial: "my_modules/protocols/protocol_description_form.html.erb", locals:
{
protocol: @protocol,
update_url: description_protocol_path(@protocol, format: :json)
}
%>
<% elsif @protocol.description.present? %>
<%= custom_auto_link(@protocol.tinymce_render(:description),
simple_format: false,
tags: %w(img),
team: current_team) %>
<% else %>
<span style="font-size: 16px"><%= t('my_modules.protocols.protocol_status_bar.no_description') %></span>
<% end %>

View file

@ -1,13 +0,0 @@
<% if can_manage_protocol_in_repository?(@protocol) %>
<%= render partial: "shared/inline_editing.html.erb",
locals: {
initial_value: @protocol.name,
config: {
field_to_udpate: 'name',
params_group: 'protocol',
path_to_update: name_protocol_path(@protocol)
}
} %>
<% else %>
<span class="view-mode"><%= @protocol.name %></span>
<% end %>

View file

@ -1 +0,0 @@
<%= l(@protocol.updated_at, format: :full) %>

View file

@ -35,15 +35,10 @@
<%= render partial: "protocols/index/general_toolbar.html.erb" %>
<%= render partial: "protocols/index/action_toolbar.html.erb" %>
<%= render partial: "protocols/index/protocol_filters.html.erb" %>
<%= render partial: "protocols/index/make_private_results_modal.html.erb" %>
<%= render partial: "protocols/index/publish_results_modal.html.erb" %>
<%= render partial: "protocols/index/confirm_archive_modal.html.erb" %>
<%= render partial: "protocols/index/archive_results_modal.html.erb" %>
<%= render partial: "protocols/index/delete_draft_modal.html.erb" %>
<%= render partial: "protocols/index/linked_children_modal.html.erb" %>
<%= render partial: "protocols/index/protocolsio_modal.html.erb" %>
<%= render partial: "protocols/index/new_protocol_modal.html.erb", locals: {type: 'new'} %>
<%= render partial: "protocols/index/protocol_preview_modal.html.erb" %>
<%= render partial: "protocols/import_export/import_elements.html.erb" %>

View file

@ -1,16 +0,0 @@
<div class="modal" id="archive-results-modal" tabindex="-1" role="dialog" aria-labelledby="archive-results-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="archive-results-modal-label">
<%= t("protocols.index.archive_results.title") %>
</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.close" %></button>
</div>
</div>
</div>
</div>

View file

@ -1,19 +0,0 @@
<div class="modal" id="confirm-archive-modal" tabindex="-1" role="dialog" aria-labelledby="confirm-archive-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="confirm-archive-modal-label">
<%= t("protocols.index.confirm_archive.title") %>
</h4>
</div>
<div class="modal-body">
<%= t("protocols.index.confirm_archive.message") %>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%= t("general.cancel") %></button>
<button type="button" class="btn btn-danger" data-action="submit"><%= t("protocols.index.confirm_archive.confirm") %></button>
</div>
</div>
</div>
</div>

View file

@ -1,16 +0,0 @@
<div class="modal" id="make-private-results-modal" tabindex="-1" role="dialog" aria-labelledby="make-private-results-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="make-private-results-modal-label">
<%= t("protocols.index.make_private_results.title") %>
</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.close" %></button>
</div>
</div>
</div>
</div>

View file

@ -1,13 +0,0 @@
<div class="modal" id="protocol-preview-modal" tabindex="-1" role="dialog" aria-labelledby="protocol-preview-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="protocol-preview-modal-label">
</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer"></div>
</div>
</div>
</div>

View file

@ -1,29 +0,0 @@
<%= render partial: "protocols/header.html.erb", locals: {preview: true} %>
<div data-role="steps-container">
<div class="row">
<div class="col-xs-8">
<h4><%= t("protocols.steps.subtitle") %></h4>
</div>
</div>
<div id="steps">
<% protocol.steps.order(:position).each do |step| %>
<%= render partial: "steps/step.html.erb", locals: { step: step, preview: true } %>
<% end %>
</div>
</div>
<%= javascript_include_tag "handsontable.full" %>
<%= javascript_include_tag "lodash" %>
<%= javascript_include_tag "numeral" %>
<%= javascript_include_tag "numeric" %>
<%= javascript_include_tag "md5" %>
<%= javascript_include_tag "jstat" %>
<%= javascript_include_tag "formula" %>
<%= javascript_include_tag "parser" %>
<%= javascript_include_tag "ruleJS" %>
<%= javascript_include_tag "handsontable.formula" %>
<%= javascript_include_tag "big.min" %>
<%= stylesheet_link_tag "handsontable.formula" %>
<%= javascript_include_tag "protocols/steps" %>

View file

@ -1,6 +0,0 @@
<button type="button" class="btn btn-secondary" data-dismiss="modal"><%=t "general.close" %></button>
<% if can_manage_protocol_in_repository?(@protocol) %>
<%= route_to_other_team_btn protocol_path(protocol),
protocol.team,
t('general.edit') %>
<% end %>

View file

@ -1,16 +0,0 @@
<div class="modal" id="publish-results-modal" tabindex="-1" role="dialog" aria-labelledby="publish-results-modal-label">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="publish-results-modal-label">
<%= t("protocols.index.publish_results.title") %>
</h4>
</div>
<div class="modal-body"></div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal"><%=t "general.close" %></button>
</div>
</div>
</div>
</div>

View file

@ -1,55 +0,0 @@
<% nr_successful = results.count { |r| r[:success] } %>
<% failed = results.select { |r| !r[:success] } %>
<% unchanged = results.select { |r| r[:success] && r[:name] == r[:new_name] } %>
<% renamed = results.select { |r| r[:success] && r[:name] != r[:new_name] } %>
<% if failed.count > 0 %>
<div class="alert alert-danger" style="margin-bottom: 15px;" role="alert">
<span class="fas fa-exclamation-triangle"></span>
<%= t("protocols.index.#{en_action}.message_failed", nr: failed.count) %>
</div>
<% end %>
<% if nr_successful > 0 %>
<div>
<%= t("protocols.index.#{en_action}.message_ok", nr: nr_successful) %>
</div>
<% end %>
<div class="well well-sm well-protocols-results">
<ul>
<% if unchanged.count > 0 %>
<% unchanged.each do |r| %>
<li>
<span class="label label-success"><%= t("protocols.index.#{en_action}.row_success") %></span>
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: h(r[:name])).html_safe %>
<% else %>
<%= r[:name] %>
<% end %>
</li>
<% end %>
<% end %>
<% if renamed.count > 0 %>
<% renamed.each do |r| %>
<li>
<span class="label label-warning"><%= t("protocols.index.#{en_action}.row_renamed") %></span>
<% protocol_str = t("protocols.index.row_renamed_html", old_name: h(r[:name]), new_name: h(r[:new_name])) %>
<% if en_action == "restore_results" %>
<%= t("protocols.index.restore_results.row_#{r[:type]}", protocol: protocol_str).html_safe %>
<% else %>
<%= protocol_str.html_safe %>
<% end %>
</li>
<% end %>
<% end %>
<% if failed.count > 0 %>
<% failed.each do |r| %>
<li>
<span class="label label-danger"><%= t("protocols.index.#{en_action}.row_failed") %></span>
<%= r[:name] %>
</li>
<% end %>
<% end %>
</ul>
</div>

View file

@ -580,7 +580,6 @@ Rails.application.routes.draw do
post 'linked_children_datatable',
to: 'protocols#linked_children_datatable'
get 'versions_modal', to: 'protocols#versions_modal'
get 'preview', to: 'protocols#preview'
patch 'description', to: 'protocols#update_description'
put 'name', to: 'protocols#update_name'
patch 'authors', to: 'protocols#update_authors'
@ -604,17 +603,12 @@ Rails.application.routes.draw do
post 'copy_to_repository', to: 'protocols#copy_to_repository'
get 'protocol_status_bar', to: 'protocols#protocol_status_bar'
get 'updated_at_label', to: 'protocols#updated_at_label'
get 'edit_name_modal', to: 'protocols#edit_name_modal'
get 'edit_keywords_modal', to: 'protocols#edit_keywords_modal'
get 'edit_authors_modal', to: 'protocols#edit_authors_modal'
get 'edit_description_modal', to: 'protocols#edit_description_modal'
post 'delete_steps'
get :permissions
put :update_version_comment
end
collection do
post 'datatable', to: 'protocols#datatable'
post 'make_private', to: 'protocols#make_private'
post 'archive', to: 'protocols#archive'
post 'restore', to: 'protocols#restore'
post 'clone', to: 'protocols#clone'