From d441f67b7042b8b9595adc810869715ab207a47d Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Thu, 21 Apr 2016 15:51:43 +0200 Subject: [PATCH 1/4] Override confirmation dialog parent element for interactions. HFJ-1572 --- js/questionset.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/js/questionset.js b/js/questionset.js index 0a84928..3b4e1f2 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -109,6 +109,7 @@ H5P.QuestionSet = function (options, contentId) { var up; renderSolutions = false; + var $template = $(template.render(params)); // Set overrides for questions var override; if (params.override.showSolutionButton || params.override.retryButton) { @@ -135,6 +136,11 @@ H5P.QuestionSet = function (options, contentId) { // Extend subcontent with the overrided settings. $.extend(question.params.behaviour, override); } + + question.params = question.params || {}; + question.params.overrideSettings = question.params.overrideSettings || {}; + question.params.overrideSettings.$confirmationDialogParent = $template; + var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); questionInstance.on('resize', function () { up = true; @@ -404,7 +410,8 @@ H5P.QuestionSet = function (options, contentId) { } // Render own DOM into target. - $myDom.html(template.render(params)); + $myDom.children().remove(); + $myDom.append($template); if (params.backgroundImage !== undefined) { $myDom.css({ overflow: 'hidden', From e90ef1f831b9aebc9187586d95d6d3fc9d0025c8 Mon Sep 17 00:00:00 2001 From: Thomas Marstrander Date: Mon, 25 Apr 2016 13:28:02 +0200 Subject: [PATCH 2/4] Added functionality for resizing Question Set if it is too small for confirmation dialog. HFJ-1572 --- js/questionset.js | 1 + 1 file changed, 1 insertion(+) diff --git a/js/questionset.js b/js/questionset.js index 3b4e1f2..c4f72ed 100644 --- a/js/questionset.js +++ b/js/questionset.js @@ -140,6 +140,7 @@ H5P.QuestionSet = function (options, contentId) { question.params = question.params || {}; question.params.overrideSettings = question.params.overrideSettings || {}; question.params.overrideSettings.$confirmationDialogParent = $template; + question.params.overrideSettings.instance = this; var questionInstance = H5P.newRunnable(question, contentId, undefined, undefined, {parent: self}); questionInstance.on('resize', function () { From 4c389c89e3cc4f6cca79e90974d5f3bf8433e44b Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 2 May 2016 10:26:55 +0200 Subject: [PATCH 3/4] Bumped patch version --- library.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.json b/library.json index 4ffc1b5..b50a5f1 100644 --- a/library.json +++ b/library.json @@ -4,7 +4,7 @@ "contentType": "question", "majorVersion": 1, "minorVersion": 8, - "patchVersion": 0, + "patchVersion": 1, "embedTypes": [ "iframe" ], @@ -61,4 +61,4 @@ "minorVersion": 1 } ] -} +} \ No newline at end of file From 9d8a35f807f7efbf07b05cb1c6a33c3bdbe7ea24 Mon Sep 17 00:00:00 2001 From: Frode Petterson Date: Mon, 2 May 2016 11:05:59 +0200 Subject: [PATCH 4/4] Added extra check to upgrade script --- upgrades.js | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/upgrades.js b/upgrades.js index a44e08f..dc41328 100644 --- a/upgrades.js +++ b/upgrades.js @@ -28,18 +28,20 @@ H5PUpgrades['H5P.QuestionSet'] = (function ($) { */ 8: function (parameters, finished) { - if (parameters.override.overrideButtons) { - // Set new variables - parameters.override.showSolutionButton = - (parameters.override.overrideShowSolutionButton ? 'on' : 'off'); - parameters.override.retryButton = - (parameters.override.overrideRetry ? 'on' : 'off'); - } + if (parameters.override) { + if (parameters.override.overrideButtons) { + // Set new variables + parameters.override.showSolutionButton = + (parameters.override.overrideShowSolutionButton ? 'on' : 'off'); + parameters.override.retryButton = + (parameters.override.overrideRetry ? 'on' : 'off'); + } - // Remove old field variables - delete parameters.override.overrideButtons; - delete parameters.override.overrideShowSolutionButton; - delete parameters.override.overrideRetry; + // Remove old field variables + delete parameters.override.overrideButtons; + delete parameters.override.overrideShowSolutionButton; + delete parameters.override.overrideRetry; + } // Move copyright dialog question label if (parameters.questionLabel) {