Skip to content

Commit

Permalink
Fix regression preventing "incompatible template" popup to appear on …
Browse files Browse the repository at this point in the history
…loading

Regression introduced in #4b9d9615898a84e263ed0a0b900ef138b93cd412 and released in 0.18.6
  • Loading branch information
bago committed Jan 26, 2023
1 parent d7b5f8a commit c2cae9d
Showing 1 changed file with 16 additions and 12 deletions.
28 changes: 16 additions & 12 deletions src/js/template-loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,19 @@ var templateLoader = function(performanceAwareCaller, templateFileName, template
});
};

var checkAndImportNewContentModel = function(performanceAwareCaller, content, allBlocks, newModel) {
var incompatibleTemplateDialog = function() {
$('#incompatible-template').dialog({
modal: true,
appendTo: '#mo-body',
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
};

var checkAndImportNewContentModel = function(performanceAwareCaller, content, allBlocks, newModel, silent) {
var compatibleTemplate = true;

// we run a basic compatibility check between the content-model we expect and the initialization model
Expand All @@ -178,17 +190,7 @@ var checkAndImportNewContentModel = function(performanceAwareCaller, content, al
compatibleTemplate = false;
}

if (!compatibleTemplate) {
$('#incompatible-template').dialog({
modal: true,
appendTo: '#mo-body',
buttons: {
Ok: function() {
$(this).dialog("close");
}
}
});
}
if ((typeof silent == 'undefined' || !silent) && !compatibleTemplate) incompatibleTemplateDialog();

return compatibleTemplate;
};
Expand Down Expand Up @@ -333,6 +335,8 @@ var templateCompiler = function(performanceAwareCaller, templateUrlConverter, te

pluginsCall(plugins, 'viewModel', [viewModel]);

if (incompatibleTemplate) incompatibleTemplateDialog();

return {
model: viewModel,
init: function() {
Expand Down

0 comments on commit c2cae9d

Please sign in to comment.