Commit 987e5837 by Tim Krones

Add "Review grade" button and hide/show/enable/disable it when appropriate.

parent 8b4df834
...@@ -4,7 +4,7 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -4,7 +4,7 @@ function MentoringWithStepsBlock(runtime, element) {
function(c) { return c.element.className.indexOf('sb-step') > -1; } function(c) { return c.element.className.indexOf('sb-step') > -1; }
); );
var activeStep = $('.mentoring', element).data('active-step'); var activeStep = $('.mentoring', element).data('active-step');
var reviewStep, checkmark, submitDOM, nextDOM, tryAgainDOM, submitXHR; var reviewStep, checkmark, submitDOM, nextDOM, reviewDOM, tryAgainDOM, submitXHR;
function isLastStep() { function isLastStep() {
return (activeStep === steps.length-1); return (activeStep === steps.length-1);
...@@ -37,6 +37,7 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -37,6 +37,7 @@ function MentoringWithStepsBlock(runtime, element) {
if (nextDOM.is(':visible')) { nextDOM.focus(); } if (nextDOM.is(':visible')) { nextDOM.focus(); }
if (isLastStep()) { if (isLastStep()) {
reviewDOM.removeAttr('disabled');
tryAgainDOM.removeAttr('disabled'); tryAgainDOM.removeAttr('disabled');
tryAgainDOM.show(); tryAgainDOM.show();
} }
...@@ -64,8 +65,11 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -64,8 +65,11 @@ function MentoringWithStepsBlock(runtime, element) {
function updateDisplay() { function updateDisplay() {
cleanAll(); cleanAll();
showActiveStep(); showActiveStep();
nextDOM.attr('disabled', 'disabled');
validateXBlock(); validateXBlock();
nextDOM.attr('disabled', 'disabled');
if (isLastStep()) {
reviewDOM.show();
}
} }
function showActiveStep() { function showActiveStep() {
...@@ -112,6 +116,7 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -112,6 +116,7 @@ function MentoringWithStepsBlock(runtime, element) {
submitDOM.show(); submitDOM.show();
if (! isLastStep()) { if (! isLastStep()) {
nextDOM.show(); nextDOM.show();
reviewDOM.hide();
} }
} }
...@@ -137,6 +142,8 @@ function MentoringWithStepsBlock(runtime, element) { ...@@ -137,6 +142,8 @@ function MentoringWithStepsBlock(runtime, element) {
nextDOM.on('click', updateDisplay); nextDOM.on('click', updateDisplay);
nextDOM.show(); nextDOM.show();
reviewDOM = $(element).find('.submit .input-review');
tryAgainDOM = $(element).find('.submit .input-try-again'); tryAgainDOM = $(element).find('.submit .input-try-again');
tryAgainDOM.on('click', tryAgain); tryAgainDOM.on('click', tryAgain);
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
<span class="assessment-checkmark fa icon-2x"></span> <span class="assessment-checkmark fa icon-2x"></span>
<input type="button" class="input-main" value="Submit" disabled="disabled" /> <input type="button" class="input-main" value="Submit" disabled="disabled" />
<input type="button" class="input-next" value="Next Step" disabled="disabled" /> <input type="button" class="input-next" value="Next Step" disabled="disabled" />
<input type="button" class="input-review" value="Review grade" disabled="disabled" />
<input type="button" class="input-try-again" value="Try again" disabled="disabled" /> <input type="button" class="input-try-again" value="Try again" disabled="disabled" />
</div> </div>
</div> </div>
......
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