Skip to content

Commit

Permalink
issue oppia#6482 fixed - Skill editor, Questions, button Save and Pub…
Browse files Browse the repository at this point in the history
…lish Question is disable untill all requirements are fulfilled
  • Loading branch information
discombobulateme committed Nov 3, 2019
1 parent 8bbc77f commit a7bfc56
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,5 @@ <h3>
</div>
<div class="modal-footer">
<button class="btn btn-secondary" ng-click="cancel()"> Cancel </button>
<button class="btn btn-success protractor-test-save-question-button" ng-click="done()"> Save and Publish Question </button>
<button class="btn btn-success protractor-test-save-question-button" ng-click="done()" ng-disabled="toggleEnableButton()"> Save and Publish Question </button>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ angular.module('oppia').directive('questionsList', [
ctrl.saveAndPublishQuestion = function() {
var validationErrors = ctrl.question.validate(
ctrl.misconceptionsBySkill);

if (validationErrors) {
AlertsService.addWarning(validationErrors);
return;
Expand Down Expand Up @@ -473,6 +474,11 @@ angular.module('oppia').directive('questionsList', [
}
$uibModalInstance.close();
};
// Checking if Question contains all requirement to enable Save and Publish Question
$scope.toggleEnableButton = function(){
return $scope.question.validate(
$scope.misconceptionsBySkill);
}

$scope.cancel = function() {
if (QuestionUndoRedoService.hasChanges()) {
Expand Down

0 comments on commit a7bfc56

Please sign in to comment.