Skip to content

Commit

Permalink
Merge pull request #11 from SergeyYukhnevich/add-override-of-check-bu…
Browse files Browse the repository at this point in the history
…tton

Add ability to override check button
  • Loading branch information
icc authored Jun 12, 2017
2 parents 976e956 + 00f6e30 commit 6c86c8a
Show file tree
Hide file tree
Showing 3 changed files with 36 additions and 17 deletions.
27 changes: 14 additions & 13 deletions js/questionset.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,20 +225,21 @@ H5P.QuestionSet = function (options, contentId, contentData) {
var $template = $(template.render(params));

// Set overrides for questions
var override;
if (params.override.showSolutionButton || params.override.retryButton) {
override = {};
if (params.override.showSolutionButton) {
// Force "Show solution" button to be on or off for all interactions
override.enableSolutionsButton =
(params.override.showSolutionButton === 'on' ? true : false);
}
var override = {};

if (params.override.retryButton) {
// Force "Retry" button to be on or off for all interactions
override.enableRetry =
(params.override.retryButton === 'on' ? true : false);
}
if (params.override.checkButton) {
// Force "Check" button to be on or off for all interactions
override.enableCheck = params.override.checkButton === 'on';
}

if (params.override.showSolutionButton) {
// Force "Show solution" button to be on or off for all interactions
override.enableSolutionsButton = params.override.showSolutionButton === 'on';
}

if (params.override.retryButton) {
// Force "Retry" button to be on or off for all interactions
override.enableRetry = params.override.retryButton === 'on';
}

/**
Expand Down
4 changes: 2 additions & 2 deletions library.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"contentType": "question",
"majorVersion": 1,
"minorVersion": 13,
"patchVersion": 0,
"patchVersion": 1,
"embedTypes": [
"iframe"
],
Expand Down Expand Up @@ -61,4 +61,4 @@
"minorVersion": 2
}
]
}
}
22 changes: 20 additions & 2 deletions semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -418,10 +418,28 @@
{
"name": "override",
"type": "group",
"label": "Settings for \"Show solution\" and \"Retry\" buttons",
"label": "Override settings for \"Check\", \"Show solution\" and \"Retry\" buttons",
"importance": "low",
"optional": true,
"fields": [
{
"name": "checkButton",
"type": "select",
"label": "Override \"Check\" button",
"importance": "low",
"description": "This option determines if the \"Check\" button will be shown for all questions, disabled for all or configured for each question individually.",
"optional": true,
"options": [
{
"value": "on",
"label": "Enabled"
},
{
"value": "off",
"label": "Disabled"
}
]
},
{
"name": "showSolutionButton",
"type": "select",
Expand Down Expand Up @@ -460,4 +478,4 @@
}
]
}
]
]

0 comments on commit 6c86c8a

Please sign in to comment.