fix: add validation to capa problem markdown for missing option text
Before this commit, if a course author created a capa mcqs or similar problem without providing any answer text for an option the question would be created causing abnormal behavior for learners. This commit will validate answer text of all options and raise an error message to author to fix the issue on the go.
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
/* End Webpack */
|
||||
|
||||
var toggleExpandCollapse, showLoadingIndicator, hideLoadingIndicator, confirmThenRunOperation,
|
||||
runOperationShowingMessage, withDisabledElement, disableElementWhileRunning,
|
||||
runOperationShowingMessage, showErrorMeassage, withDisabledElement, disableElementWhileRunning,
|
||||
getScrollOffset, setScrollOffset, setScrollTop, redirect, reload, hasChangedAttributes,
|
||||
deleteNotificationHandler, validateRequiredField, validateURLItemEncoding,
|
||||
validateTotalKeyLength, checkTotalKeyLengthViolations, loadJavaScript;
|
||||
@@ -95,6 +95,21 @@
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* Shows an error notification message for a specifc period of time.
|
||||
* @param heading The heading of notification.
|
||||
* @param message The message to show.
|
||||
* @param timeInterval The time interval to hide the notification.
|
||||
*/
|
||||
showErrorMeassage = function(heading, message, timeInterval) {
|
||||
var errorNotificationView = new NotificationView.Error({
|
||||
title: gettext(heading),
|
||||
message: gettext(message)
|
||||
});
|
||||
errorNotificationView.show();
|
||||
|
||||
setTimeout(function() { errorNotificationView.hide(); }, timeInterval);
|
||||
};
|
||||
/**
|
||||
* Wraps a Backbone event callback to disable the event's target element.
|
||||
*
|
||||
@@ -295,6 +310,7 @@
|
||||
hideLoadingIndicator: hideLoadingIndicator,
|
||||
confirmThenRunOperation: confirmThenRunOperation,
|
||||
runOperationShowingMessage: runOperationShowingMessage,
|
||||
showErrorMeassage: showErrorMeassage,
|
||||
withDisabledElement: withDisabledElement,
|
||||
disableElementWhileRunning: disableElementWhileRunning,
|
||||
deleteNotificationHandler: deleteNotificationHandler,
|
||||
|
||||
Reference in New Issue
Block a user