mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-11 15:45:34 +08:00
Update the text of the inlink protocol modal [SCI-7909]
This commit is contained in:
parent
cb332f163f
commit
4b264db343
3 changed files with 19 additions and 6 deletions
|
@ -99,12 +99,23 @@ function initLinkUpdate() {
|
||||||
var updateBtn = modal.find(".modal-footer [data-action='submit']");
|
var updateBtn = modal.find(".modal-footer [data-action='submit']");
|
||||||
$("[data-action='unlink'], [data-action='revert'], [data-action='update-parent'], [data-action='update-self']")
|
$("[data-action='unlink'], [data-action='revert'], [data-action='update-parent'], [data-action='update-self']")
|
||||||
.on('ajax:success', function(e, data) {
|
.on('ajax:success', function(e, data) {
|
||||||
modalTitle.html(data.title);
|
const modalBodyTemplate = (message, warning) => `<p class="message">${message}</p>
|
||||||
modalBody.html(data.message);
|
<p class="message">${warning || ''}</p>`;
|
||||||
updateBtn.text(data.btn_text);
|
const {
|
||||||
modal.attr('data-url', data.url);
|
title,
|
||||||
|
message,
|
||||||
|
warning,
|
||||||
|
btn_text: btnText,
|
||||||
|
url
|
||||||
|
} = data;
|
||||||
|
|
||||||
|
modalTitle.html(title);
|
||||||
|
modalBody.html(modalBodyTemplate(message, warning));
|
||||||
|
updateBtn.text(btnText);
|
||||||
|
modal.attr('data-url', url);
|
||||||
modal.modal('show');
|
modal.modal('show');
|
||||||
});
|
});
|
||||||
|
|
||||||
modal.on('hidden.bs.modal', function() {
|
modal.on('hidden.bs.modal', function() {
|
||||||
modalBody.html('');
|
modalBody.html('');
|
||||||
});
|
});
|
||||||
|
|
|
@ -881,6 +881,7 @@ class ProtocolsController < ApplicationController
|
||||||
render json: {
|
render json: {
|
||||||
title: t('my_modules.protocols.confirm_link_update_modal.unlink_title'),
|
title: t('my_modules.protocols.confirm_link_update_modal.unlink_title'),
|
||||||
message: t('my_modules.protocols.confirm_link_update_modal.unlink_message'),
|
message: t('my_modules.protocols.confirm_link_update_modal.unlink_message'),
|
||||||
|
warning: t('my_modules.protocols.confirm_link_update_modal.unlink_warning'),
|
||||||
btn_text: t('my_modules.protocols.confirm_link_update_modal.unlink_btn_text'),
|
btn_text: t('my_modules.protocols.confirm_link_update_modal.unlink_btn_text'),
|
||||||
url: unlink_protocol_path(@protocol)
|
url: unlink_protocol_path(@protocol)
|
||||||
}
|
}
|
||||||
|
|
|
@ -1074,8 +1074,9 @@ en:
|
||||||
update_self_title: "Update this protocol with the version stored in the templates"
|
update_self_title: "Update this protocol with the version stored in the templates"
|
||||||
confirm_link_update_modal:
|
confirm_link_update_modal:
|
||||||
unlink_title: "Unlink protocol template"
|
unlink_title: "Unlink protocol template"
|
||||||
unlink_message: "Are you sure you want to unlink the task protocol from the templates version? This will stop any tracking of changes."
|
unlink_message: "This will stop tracking changes of protocol templates. We can’t link it back once you unlink it."
|
||||||
unlink_btn_text: "Unlink"
|
unlink_warning: "Are you sure?"
|
||||||
|
unlink_btn_text: "Yes, unlink it"
|
||||||
revert_title: "Revert protocol"
|
revert_title: "Revert protocol"
|
||||||
revert_message: "Are you sure you want to revert the task protocol to the templates version? This will override any local changes you made."
|
revert_message: "Are you sure you want to revert the task protocol to the templates version? This will override any local changes you made."
|
||||||
revert_btn_text: "Revert"
|
revert_btn_text: "Revert"
|
||||||
|
|
Loading…
Add table
Reference in a new issue