From ce1b23b200dff051d97462867a39845fc2216ce5 Mon Sep 17 00:00:00 2001 From: Ighomena Odebala Date: Tue, 26 May 2026 15:43:17 +0100 Subject: [PATCH] Block changes for migrated static and compendium pages --- src/legacy/js/functions/_editAlert.js | 12 ++++++++++++ src/legacy/js/functions/_editDocumentCorrection.js | 12 ++++++++++++ .../js/functions/_t7StaticLandingPageEditor.js | 12 ++++++++++++ 3 files changed, 36 insertions(+) diff --git a/src/legacy/js/functions/_editAlert.js b/src/legacy/js/functions/_editAlert.js index 175a786c4d..98c0205ecb 100644 --- a/src/legacy/js/functions/_editAlert.js +++ b/src/legacy/js/functions/_editAlert.js @@ -15,6 +15,10 @@ function editAlert(collectionId, data, templateData, field, idField) { initialiseAlert(collectionId, data, templateData, field, idField); // New alert $("#add-" + idField).click(function () { + // Block add if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } if (!data[field]) { data[field] = []; templateData[field] = []; @@ -45,6 +49,10 @@ function initialiseAlert(collectionId, data, templateData, field, idField) { templateData[field][index].date = new Date($('#date_' + index).datepicker('getDate')).toISOString(); }); $('#' + idField + '-edit_' + index).click(function () { + // Block edit if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } var editedSectionValue = {title: 'Alert notice', markdown: data[field][index].markdown}; //var editedSectionValue = data[field][index].markdown; var saveContent = function (updatedContent) { @@ -79,6 +87,10 @@ function initialiseAlert(collectionId, data, templateData, field, idField) { // Delete $('#' + idField + '-delete_' + index).click(function () { + // Block delete if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } swal ({ title: "Warning", text: "Are you sure you want to delete this alert?", diff --git a/src/legacy/js/functions/_editDocumentCorrection.js b/src/legacy/js/functions/_editDocumentCorrection.js index a305fcdcbb..e4be60d6a9 100644 --- a/src/legacy/js/functions/_editDocumentCorrection.js +++ b/src/legacy/js/functions/_editDocumentCorrection.js @@ -15,6 +15,10 @@ function editDocumentCorrection(collectionId, data, templateData, field, idField initialiseCorrection(collectionId, data, templateData, field, idField); // New correction $("#add-" + idField).one('click', function () { + // Block add if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } if (!data[field]) { data[field] = []; templateData[field] = []; @@ -127,6 +131,10 @@ function initialiseCorrection(collectionId, data, templateData, field, idField) $('#' + idField + '-edit_' + index).click(function () { + // Block edit if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } var markdown = data[field][index].correctionNotice; var editedSectionValue = {title: 'Correction notice', markdown: markdown}; var saveContent = function (updatedContent) { @@ -138,6 +146,10 @@ function initialiseCorrection(collectionId, data, templateData, field, idField) }); // Delete $('#' + idField + '-delete_' + index).click(function () { + // Block delete if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } swal ({ title: "Warning", text: "Are you sure you want to delete this correction?", diff --git a/src/legacy/js/functions/_t7StaticLandingPageEditor.js b/src/legacy/js/functions/_t7StaticLandingPageEditor.js index b093028241..701c9de25a 100644 --- a/src/legacy/js/functions/_t7StaticLandingPageEditor.js +++ b/src/legacy/js/functions/_t7StaticLandingPageEditor.js @@ -84,6 +84,10 @@ function staticLandingPageEditor(collectionId, data) { } $("#section-edit_" + index).click(function () { + // Block edit if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } var editedSectionValue = { "title": $('#section-title_' + index).val(), "markdown": $("#section-markdown_" + index).val() @@ -101,6 +105,10 @@ function staticLandingPageEditor(collectionId, data) { // Delete $("#section-delete_" + index).click(function () { + // Block delete if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } swal({ title: "Warning", text: "Are you sure you want to delete?", @@ -156,6 +164,10 @@ function staticLandingPageEditor(collectionId, data) { //Add new content $("#add-section").one('click', function () { + // Block add if content has migration link + if (blockNonMigrationChangeWithWarning()) { + return; + } swal({ title: "Warning", text: "If you do not come back to this page, you will lose any unsaved changes",