Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to override check button #11

Merged
merged 1 commit into from
Jun 12, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
}
]
}
]
]