Merge pull request #1874 from crazyserver/MOBILE-2966
MOBILE-2966 quiz: Clear answer in multiple choice single answermain
commit
ea969fe211
|
@ -637,6 +637,7 @@
|
|||
"addon.mod_quiz.attemptquiznow": "quiz",
|
||||
"addon.mod_quiz.attemptstate": "quiz",
|
||||
"addon.mod_quiz.cannotsubmitquizdueto": "local_moodlemobileapp",
|
||||
"addon.mod_quiz.clearchoice": "qtype_multichoice",
|
||||
"addon.mod_quiz.comment": "quiz",
|
||||
"addon.mod_quiz.completedon": "quiz",
|
||||
"addon.mod_quiz.confirmclose": "quiz",
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
"attemptquiznow": "Attempt quiz now",
|
||||
"attemptstate": "State",
|
||||
"cannotsubmitquizdueto": "This quiz attempt cannot be submitted for the following reasons:",
|
||||
"clearchoice": "Clear my choice",
|
||||
"comment": "Comment",
|
||||
"completedon": "Completed on",
|
||||
"confirmclose": "Once you submit, you will no longer be able to change your answers for this attempt.",
|
||||
|
|
|
@ -32,6 +32,9 @@
|
|||
<core-icon item-content *ngIf="option.isCorrect === 1" class="core-correct-icon" name="fa-check" color="success"></core-icon>
|
||||
<core-icon item-content *ngIf="option.isCorrect === 0" class="core-correct-icon" name="fa-remove" color="danger"></core-icon>
|
||||
</ion-item>
|
||||
<div *ngIf="!question.disabled" padding-horizontal>
|
||||
<button text-wrap [disabled]="!question.singleChoiceModel" ion-button full color="light" (click)="clear()" type="reset">{{ 'addon.mod_quiz.clearchoice' | translate }}</button>
|
||||
</div>
|
||||
|
||||
<!-- ion-radio doesn't use an input. Create a hidden input to hold the selected value. -->
|
||||
<input type="hidden" [ngModel]="question.singleChoiceModel" [attr.name]="question.optionsName">
|
||||
|
|
|
@ -35,4 +35,11 @@ export class AddonQtypeMultichoiceComponent extends CoreQuestionBaseComponent im
|
|||
ngOnInit(): void {
|
||||
this.initMultichoiceComponent();
|
||||
}
|
||||
|
||||
/**
|
||||
* Clear selected choices.
|
||||
*/
|
||||
clear(): void {
|
||||
this.question.singleChoiceModel = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -637,6 +637,7 @@
|
|||
"addon.mod_quiz.attemptquiznow": "Attempt quiz now",
|
||||
"addon.mod_quiz.attemptstate": "State",
|
||||
"addon.mod_quiz.cannotsubmitquizdueto": "This quiz attempt cannot be submitted for the following reasons:",
|
||||
"addon.mod_quiz.clearchoice": "Clear my choice",
|
||||
"addon.mod_quiz.comment": "Comment",
|
||||
"addon.mod_quiz.completedon": "Completed on",
|
||||
"addon.mod_quiz.confirmclose": "Once you submit, you will no longer be able to change your answers for this attempt.",
|
||||
|
|
|
@ -448,6 +448,8 @@ export class CoreQuestionBaseComponent {
|
|||
|
||||
this.question.options = [];
|
||||
|
||||
this.question.disabled = true;
|
||||
|
||||
for (const i in options) {
|
||||
const element = options[i],
|
||||
option: any = {
|
||||
|
@ -461,6 +463,8 @@ export class CoreQuestionBaseComponent {
|
|||
|
||||
this.question.optionsName = option.name;
|
||||
|
||||
this.question.disabled = this.question.disabled && element.disabled;
|
||||
|
||||
// Get the label with the question text.
|
||||
const label = questionEl.querySelector('label[for="' + option.id + '"]');
|
||||
if (label) {
|
||||
|
|
Loading…
Reference in New Issue