Skip to content

Commit

Permalink
HFP-3956 Show keep answers option conditionally
Browse files Browse the repository at this point in the history
  • Loading branch information
otacke committed Aug 6, 2024
1 parent 78b6ff8 commit 1807bd2
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
14 changes: 12 additions & 2 deletions semantics.json
Original file line number Diff line number Diff line change
Expand Up @@ -397,7 +397,17 @@
"description": "If this option is enabled, correct answers will be kept when the user retries the task unless full score was achieved.",
"importance": "low",
"default": false,
"optional": true
"optional": true,
"widget": "showWhen",
"showWhen": {
"rules": [
{
"field": "enableRetry",
"equals": true
}
],
"nullWhenHidden": true
}
}
]
},
Expand Down Expand Up @@ -629,4 +639,4 @@
}
]
}
]
]
5 changes: 5 additions & 0 deletions src/scripts/h5p-crossword.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,11 @@ export default class Crossword extends H5P.Question {
}
}, this.params);

// Ensure to consider enableRetry for keepCorrectAnswers
this.params.keepCorrectAnswers =
this.params.behaviour.enableRetry &&
this.params.behaviour.keepCorrectAnswers;

/*
* Remove values that match the default, so the regular stylesheet values
* will be used to still allow CSS overrides via H5P's hook.
Expand Down

0 comments on commit 1807bd2

Please sign in to comment.