Commit 431bc480 by Tim Krones

Handle cases where review step is not present (because it has not been

added to current mentoring block).
parent d91007ae
......@@ -14,6 +14,10 @@ function MentoringWithStepsBlock(runtime, element) {
return (activeStep === -1);
}
function reviewStepPresent() {
return reviewStep.length > 0;
}
function updateActiveStep(newValue) {
var handlerUrl = runtime.handlerUrl(element, 'update_active_step');
$.post(handlerUrl, JSON.stringify(newValue))
......@@ -41,7 +45,12 @@ function MentoringWithStepsBlock(runtime, element) {
if (nextDOM.is(':visible')) { nextDOM.focus(); }
if (isLastStep()) {
reviewDOM.removeAttr('disabled');
if (reviewStepPresent()) {
reviewDOM.removeAttr('disabled');
} else {
tryAgainDOM.removeAttr('disabled');
tryAgainDOM.show();
}
}
}
......@@ -72,7 +81,7 @@ function MentoringWithStepsBlock(runtime, element) {
showActiveStep();
validateXBlock();
nextDOM.attr('disabled', 'disabled');
if (isLastStep()) {
if (isLastStep() && reviewStepPresent()) {
reviewDOM.show();
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment