mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-09-08 22:24:23 +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']");
|
||||
$("[data-action='unlink'], [data-action='revert'], [data-action='update-parent'], [data-action='update-self']")
|
||||
.on('ajax:success', function(e, data) {
|
||||
modalTitle.html(data.title);
|
||||
modalBody.html(data.message);
|
||||
updateBtn.text(data.btn_text);
|
||||
modal.attr('data-url', data.url);
|
||||
const modalBodyTemplate = (message, warning) => `<p class="message">${message}</p>
|
||||
<p class="message">${warning || ''}</p>`;
|
||||
const {
|
||||
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.on('hidden.bs.modal', function() {
|
||||
modalBody.html('');
|
||||
});
|
||||
|
|
|
@ -881,6 +881,7 @@ class ProtocolsController < ApplicationController
|
|||
render json: {
|
||||
title: t('my_modules.protocols.confirm_link_update_modal.unlink_title'),
|
||||
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'),
|
||||
url: unlink_protocol_path(@protocol)
|
||||
}
|
||||
|
|
|
@ -1074,8 +1074,9 @@ en:
|
|||
update_self_title: "Update this protocol with the version stored in the templates"
|
||||
confirm_link_update_modal:
|
||||
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_btn_text: "Unlink"
|
||||
unlink_message: "This will stop tracking changes of protocol templates. We can’t link it back once you unlink it."
|
||||
unlink_warning: "Are you sure?"
|
||||
unlink_btn_text: "Yes, unlink it"
|
||||
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_btn_text: "Revert"
|
||||
|
|
Loading…
Add table
Reference in a new issue