From 23df5987b8a145498c0e7799d60e0d8ef69cba19 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Mon, 15 Jul 2024 01:35:00 +0800 Subject: [PATCH 01/21] Functional reset choices button in rubrics edit question --- .../rubric-question-edit-answer-form.component.html | 9 +++++++++ .../rubric-question-edit-answer-form.component.ts | 6 ++++++ 2 files changed, 15 insertions(+) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 0726171c963..6d8cdf55a03 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -47,3 +47,12 @@ + \ No newline at end of file diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index 79d2972de14..4796eb49549 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -71,4 +71,10 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor getInputId(id: string, row: number, col: number, platform: string): string { return `${id}-row${row}-col${col}-${platform}`; } + + resetRubricAnswer(): void { + const resettedAnswer: number[] = + Array(this.questionDetails.rubricSubQuestions.length).fill(RUBRIC_ANSWER_NOT_CHOSEN); + this.triggerResponseDetailsChange('answer', resettedAnswer); + } } From c5ad013fc315a5c714420a3c68c6de78a25e98b1 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Mon, 15 Jul 2024 01:53:37 +0800 Subject: [PATCH 02/21] Alert warning created for reset --- .../rubric-question-edit-answer-form.component.html | 2 +- .../rubric-question-edit-answer-form.component.ts | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 6d8cdf55a03..2a7d9a6149b 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -53,6 +53,6 @@ id="btn-reset" name="button-reset" class="btn btn-secondary" - (click)="resetRubricAnswer()"> + (click)="confirmReset()"> Reset choices \ No newline at end of file diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index 4796eb49549..c6901dcca23 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -72,6 +72,12 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor return `${id}-row${row}-col${col}-${platform}`; } + confirmReset(): void { + if (confirm('Are you sure you want to reset all choices?')) { + this.resetRubricAnswer(); + } + } + resetRubricAnswer(): void { const resettedAnswer: number[] = Array(this.questionDetails.rubricSubQuestions.length).fill(RUBRIC_ANSWER_NOT_CHOSEN); From 0ca6127fb91e5c3218ca3a04f751b996b994c265 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Mon, 15 Jul 2024 03:07:20 +0800 Subject: [PATCH 03/21] Make button separated from rubric table --- ...c-question-edit-answer-form.component.html | 93 ++++++++++--------- ...c-question-edit-answer-form.component.scss | 9 ++ 2 files changed, 58 insertions(+), 44 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 2a7d9a6149b..feb16572466 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -1,58 +1,63 @@ - - - - - - - - - - - - - -
{{ choice }}
{{ questionDetails.rubricSubQuestions[i] }} - - -
-
-
-
- {{ questionDetails.rubricSubQuestions[i] }} -
-
-
-
\ No newline at end of file diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.scss b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.scss index 8dedeab443a..d5664b0b04b 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.scss +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.scss @@ -17,3 +17,12 @@ display: none; } } + +.table-container { + margin-bottom: 1.25em; +} + +.button-container { + display: flex; + justify-content: flex-end; +} From e652b976fce9f1f3e3cb1235e56ebaed9d9067cf Mon Sep 17 00:00:00 2001 From: NeoHW Date: Mon, 15 Jul 2024 22:39:53 +0800 Subject: [PATCH 04/21] Fix linting issues of extra whitespace --- .../rubric-question-edit-answer-form.component.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index c6901dcca23..f3e41094b36 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -79,7 +79,7 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor } resetRubricAnswer(): void { - const resettedAnswer: number[] = + const resettedAnswer: number[] = Array(this.questionDetails.rubricSubQuestions.length).fill(RUBRIC_ANSWER_NOT_CHOSEN); this.triggerResponseDetailsChange('answer', resettedAnswer); } From f33bfb7a94230052ef971863dc7902b7e3f7f276 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Tue, 16 Jul 2024 00:24:15 +0800 Subject: [PATCH 05/21] Add reset choices comfirmation component --- .../question-edit-answer-form.module.ts | 2 + .../reset-choices-comfirmation.component.html | 19 +++ .../reset-choices-comfirmation.component.scss | 0 ...set-choices-comfirmation.component.spec.ts | 21 ++++ .../reset-choices-comfirmation.component.ts | 22 ++++ ...c-question-edit-answer-form.component.html | 115 ++++++++++-------- ...ric-question-edit-answer-form.component.ts | 17 ++- 7 files changed, 139 insertions(+), 57 deletions(-) create mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html create mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss create mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts create mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts diff --git a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts index fbfb919e621..fd04831211e 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts @@ -17,6 +17,7 @@ import { TextQuestionEditAnswerFormComponent } from './text-question-edit-answer import { RichTextEditorModule } from '../../rich-text-editor/rich-text-editor.module'; import { TeammatesCommonModule } from '../../teammates-common/teammates-common.module'; import { WheelDisablerModule } from '../../wheel-disabler/wheel-disabler.module'; +import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; /** * Module for all different types of question edit answer forms. @@ -34,6 +35,7 @@ import { WheelDisablerModule } from '../../wheel-disabler/wheel-disabler.module' RubricQuestionEditAnswerFormComponent, ConstsumOptionsQuestionEditAnswerFormComponent, ConstsumRecipientsQuestionEditAnswerFormComponent, + ResetChoicesComfirmationComponent, ], exports: [ ContributionQuestionEditAnswerFormComponent, diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html new file mode 100644 index 00000000000..0085ffccbf8 --- /dev/null +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html @@ -0,0 +1,19 @@ + + \ No newline at end of file diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts new file mode 100644 index 00000000000..8993eaf3953 --- /dev/null +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts @@ -0,0 +1,21 @@ +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; + +describe('ResetChoicesComfirmationComponent', () => { + let component: ResetChoicesComfirmationComponent; + let fixture: ComponentFixture; + + beforeEach(() => { + TestBed.configureTestingModule({ + declarations: [ResetChoicesComfirmationComponent] + }); + fixture = TestBed.createComponent(ResetChoicesComfirmationComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts new file mode 100644 index 00000000000..99bc3406650 --- /dev/null +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts @@ -0,0 +1,22 @@ +import { Component, Output, EventEmitter } from '@angular/core'; + +@Component({ + selector: 'tm-reset-choices-comfirmation', + templateUrl: './reset-choices-comfirmation.component.html', + styleUrls: ['./reset-choices-comfirmation.component.scss'] +}) +export class ResetChoicesComfirmationComponent { + @Output() + confirmReset: EventEmitter = new EventEmitter(); + + onConfirm(): void { + this.confirmReset.emit(true); + } + + onCancel(): void { + this.confirmReset.emit(false); + } +} + + + diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index feb16572466..d74f8fda43a 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -1,63 +1,70 @@ -
- - - - - - - - - - - - - -
{{ choice }}
{{ questionDetails.rubricSubQuestions[i] }} - - -
-
-
-
- {{ questionDetails.rubricSubQuestions[i] }} -
-
-
-
- \ No newline at end of file + diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts index 99bc3406650..7a2f4c1b9f7 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts @@ -17,6 +17,3 @@ export class ResetChoicesComfirmationComponent { this.confirmReset.emit(false); } } - - - From 8484f5d437fb287cffea9df34a208777eedeeed5 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Tue, 16 Jul 2024 00:45:30 +0800 Subject: [PATCH 07/21] Fix linting issues --- .../question-edit-answer-form.module.ts | 2 +- .../reset-choices-comfirmation.component.spec.ts | 2 +- .../reset-choices-comfirmation.component.ts | 6 +++--- .../rubric-question-edit-answer-form.component.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts index fd04831211e..fe07a1e3fba 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts @@ -12,12 +12,12 @@ import { MsqQuestionEditAnswerFormComponent } from './msq-question-edit-answer-f import { NumScaleQuestionEditAnswerFormComponent } from './num-scale-question-edit-answer-form.component'; import { RankOptionsQuestionEditAnswerFormComponent } from './rank-options-question-edit-answer-form.component'; import { RankRecipientsQuestionEditAnswerFormComponent } from './rank-recipients-question-edit-answer-form.component'; +import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; import { RubricQuestionEditAnswerFormComponent } from './rubric-question-edit-answer-form.component'; import { TextQuestionEditAnswerFormComponent } from './text-question-edit-answer-form.component'; import { RichTextEditorModule } from '../../rich-text-editor/rich-text-editor.module'; import { TeammatesCommonModule } from '../../teammates-common/teammates-common.module'; import { WheelDisablerModule } from '../../wheel-disabler/wheel-disabler.module'; -import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; /** * Module for all different types of question edit answer forms. diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts index 8993eaf3953..eae7a499086 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts @@ -8,7 +8,7 @@ describe('ResetChoicesComfirmationComponent', () => { beforeEach(() => { TestBed.configureTestingModule({ - declarations: [ResetChoicesComfirmationComponent] + declarations: [ResetChoicesComfirmationComponent], }); fixture = TestBed.createComponent(ResetChoicesComfirmationComponent); component = fixture.componentInstance; diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts index 7a2f4c1b9f7..a28c0c0aca0 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts @@ -3,16 +3,16 @@ import { Component, Output, EventEmitter } from '@angular/core'; @Component({ selector: 'tm-reset-choices-comfirmation', templateUrl: './reset-choices-comfirmation.component.html', - styleUrls: ['./reset-choices-comfirmation.component.scss'] + styleUrls: ['./reset-choices-comfirmation.component.scss'], }) export class ResetChoicesComfirmationComponent { @Output() confirmReset: EventEmitter = new EventEmitter(); - + onConfirm(): void { this.confirmReset.emit(true); } - + onCancel(): void { this.confirmReset.emit(false); } diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index 15cb97e55c8..5ee152c4ea4 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -32,7 +32,7 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor @Output() resetWarningTriggered: EventEmitter = new EventEmitter(); - + showResetWarning: boolean = false; constructor() { From bd72730a6cd16d72711fe61d179616ed46127efa Mon Sep 17 00:00:00 2001 From: NeoHW Date: Tue, 16 Jul 2024 01:13:52 +0800 Subject: [PATCH 08/21] Fix snap test --- ...ion-submission-page.component.spec.ts.snap | 666 +++++++++--------- 1 file changed, 352 insertions(+), 314 deletions(-) diff --git a/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap b/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap index 5110ed14b92..7858985ba60 100644 --- a/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap +++ b/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap @@ -3012,173 +3012,192 @@ exports[`SessionSubmissionPageComponent should snap with feedback session questi class="margin-top-20px col" > - - - - - - - - - +
+
- - choice 1 - - choice 2 -
- - + + + + + + - description 1 - - - + + + - description 2 - - - - + subquestion 2 + + + + + +
- subquestion 1 - - -
+ + choice 1 + + choice 2 +
- - + + + + + +
+ + + + + +
+
- - subquestion 2 - - - - - - - -
\ No newline at end of file +
From 2e252ab0eb1f1b8381ec419acfa0072c38d4a20d Mon Sep 17 00:00:00 2001 From: NeoHW Date: Wed, 31 Jul 2024 03:44:17 +0800 Subject: [PATCH 10/21] Reset button to use Modal Service warning --- ...c-question-edit-answer-form.component.html | 10 ++++--- ...ric-question-edit-answer-form.component.ts | 29 ++++++++++++------- 2 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 42efdd6a450..026c5af4bb0 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -53,16 +53,18 @@
-
+ + diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index 5ee152c4ea4..b372376a622 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -7,6 +7,9 @@ import { DEFAULT_RUBRIC_QUESTION_DETAILS, DEFAULT_RUBRIC_RESPONSE_DETAILS, } from '../../../../types/default-question-structs'; import { RUBRIC_ANSWER_NOT_CHOSEN } from '../../../../types/feedback-response-details'; +import { SimpleModalService } from '../../../../services/simple-modal.service' +import { SimpleModalType } from '../../simple-modal/simple-modal-type'; + /** * The rubric question submission form for a recipient. @@ -35,7 +38,7 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor showResetWarning: boolean = false; - constructor() { + constructor(private simpleModalService: SimpleModalService) { super(DEFAULT_RUBRIC_QUESTION_DETAILS(), DEFAULT_RUBRIC_RESPONSE_DETAILS()); } @@ -77,17 +80,23 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor return `${id}-row${row}-col${col}-${platform}`; } - triggerResetWarning(): void { - this.showResetWarning = true; - this.resetWarningTriggered.emit(); + resetHandler(): void { + this.simpleModalService.openConfirmationModal( + `Reset Choices?`, + SimpleModalType.WARNING, + 'Are you sure you want to reset your choices? This action cannot be reverted' + ).result.then(() => { + this.resetRubricAnswer(); + // this.resetWarningTriggered.emit(); + }, () => {}); } - confirmReset(confirm: boolean): void { - if (confirm) { - this.resetRubricAnswer(); - } - this.showResetWarning = false; - } + // confirmReset(confirm: boolean): void { + // if (confirm) { + // this.resetRubricAnswer(); + // } + // this.showResetWarning = false; + // } resetRubricAnswer(): void { const resettedAnswer: number[] = From e771541176ebd3982b35ad4cff1cfd4f5fbfcc7a Mon Sep 17 00:00:00 2001 From: NeoHW Date: Wed, 31 Jul 2024 03:45:10 +0800 Subject: [PATCH 11/21] Clean up commented code --- .../rubric-question-edit-answer-form.component.html | 7 ------- .../rubric-question-edit-answer-form.component.ts | 8 -------- 2 files changed, 15 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 026c5af4bb0..7be314be80c 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -61,10 +61,3 @@ (click)="resetHandler()"> Reset choices - - diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index b372376a622..5fc5a2ece07 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -87,17 +87,9 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor 'Are you sure you want to reset your choices? This action cannot be reverted' ).result.then(() => { this.resetRubricAnswer(); - // this.resetWarningTriggered.emit(); }, () => {}); } - // confirmReset(confirm: boolean): void { - // if (confirm) { - // this.resetRubricAnswer(); - // } - // this.showResetWarning = false; - // } - resetRubricAnswer(): void { const resettedAnswer: number[] = Array(this.questionDetails.rubricSubQuestions.length).fill(RUBRIC_ANSWER_NOT_CHOSEN); From cc6813341bdefc57efb977a95eea4c06afbc609d Mon Sep 17 00:00:00 2001 From: NeoHW Date: Wed, 31 Jul 2024 03:49:08 +0800 Subject: [PATCH 12/21] Remove unused component files --- .../question-edit-answer-form.module.ts | 2 -- .../reset-choices-comfirmation.component.html | 19 ----------------- .../reset-choices-comfirmation.component.scss | 0 ...set-choices-comfirmation.component.spec.ts | 21 ------------------- .../reset-choices-comfirmation.component.ts | 19 ----------------- 5 files changed, 61 deletions(-) delete mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html delete mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss delete mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts delete mode 100644 src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts diff --git a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts index fe07a1e3fba..fbfb919e621 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/question-edit-answer-form.module.ts @@ -12,7 +12,6 @@ import { MsqQuestionEditAnswerFormComponent } from './msq-question-edit-answer-f import { NumScaleQuestionEditAnswerFormComponent } from './num-scale-question-edit-answer-form.component'; import { RankOptionsQuestionEditAnswerFormComponent } from './rank-options-question-edit-answer-form.component'; import { RankRecipientsQuestionEditAnswerFormComponent } from './rank-recipients-question-edit-answer-form.component'; -import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; import { RubricQuestionEditAnswerFormComponent } from './rubric-question-edit-answer-form.component'; import { TextQuestionEditAnswerFormComponent } from './text-question-edit-answer-form.component'; import { RichTextEditorModule } from '../../rich-text-editor/rich-text-editor.module'; @@ -35,7 +34,6 @@ import { WheelDisablerModule } from '../../wheel-disabler/wheel-disabler.module' RubricQuestionEditAnswerFormComponent, ConstsumOptionsQuestionEditAnswerFormComponent, ConstsumRecipientsQuestionEditAnswerFormComponent, - ResetChoicesComfirmationComponent, ], exports: [ ContributionQuestionEditAnswerFormComponent, diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html deleted file mode 100644 index 0ca19d8d6a8..00000000000 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.html +++ /dev/null @@ -1,19 +0,0 @@ - - diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.scss deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts deleted file mode 100644 index eae7a499086..00000000000 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.spec.ts +++ /dev/null @@ -1,21 +0,0 @@ -import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { ResetChoicesComfirmationComponent } from './reset-choices-comfirmation.component'; - -describe('ResetChoicesComfirmationComponent', () => { - let component: ResetChoicesComfirmationComponent; - let fixture: ComponentFixture; - - beforeEach(() => { - TestBed.configureTestingModule({ - declarations: [ResetChoicesComfirmationComponent], - }); - fixture = TestBed.createComponent(ResetChoicesComfirmationComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts b/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts deleted file mode 100644 index a28c0c0aca0..00000000000 --- a/src/web/app/components/question-types/question-edit-answer-form/reset-choices-comfirmation.component.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { Component, Output, EventEmitter } from '@angular/core'; - -@Component({ - selector: 'tm-reset-choices-comfirmation', - templateUrl: './reset-choices-comfirmation.component.html', - styleUrls: ['./reset-choices-comfirmation.component.scss'], -}) -export class ResetChoicesComfirmationComponent { - @Output() - confirmReset: EventEmitter = new EventEmitter(); - - onConfirm(): void { - this.confirmReset.emit(true); - } - - onCancel(): void { - this.confirmReset.emit(false); - } -} From 831788445395d5d91e3348f815c95c8bf27132b8 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Wed, 31 Jul 2024 04:01:15 +0800 Subject: [PATCH 13/21] Update snapshot --- .../session-submission-page.component.spec.ts.snap | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap b/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap index a1cb5608446..3231979cb52 100644 --- a/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap +++ b/src/web/app/pages-session/session-submission-page/__snapshots__/session-submission-page.component.spec.ts.snap @@ -3257,6 +3257,7 @@ exports[`SessionSubmissionPageComponent should snap with feedback session questi class="btn btn-secondary" id="btn-reset" name="button-reset" + ngbtooltip="Reset current choices" title="Reset choices" type="button" > @@ -6386,6 +6387,7 @@ exports[`SessionSubmissionPageComponent should snap with feedback session questi class="btn btn-secondary" id="btn-reset" name="button-reset" + ngbtooltip="Reset current choices" title="Reset choices" type="button" > From 8ddb5668eba6313c467e476ae6da66660d9a03c1 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Wed, 31 Jul 2024 04:04:33 +0800 Subject: [PATCH 14/21] Fix linting issues --- .../rubric-question-edit-answer-form.component.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index 5fc5a2ece07..ae90512ff67 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -1,5 +1,6 @@ import { Component, Input, Output, EventEmitter } from '@angular/core'; import { QuestionEditAnswerFormComponent } from './question-edit-answer-form'; +import { SimpleModalService } from '../../../../services/simple-modal.service'; import { FeedbackRubricQuestionDetails, FeedbackRubricResponseDetails, } from '../../../../types/api-output'; @@ -7,10 +8,8 @@ import { DEFAULT_RUBRIC_QUESTION_DETAILS, DEFAULT_RUBRIC_RESPONSE_DETAILS, } from '../../../../types/default-question-structs'; import { RUBRIC_ANSWER_NOT_CHOSEN } from '../../../../types/feedback-response-details'; -import { SimpleModalService } from '../../../../services/simple-modal.service' import { SimpleModalType } from '../../simple-modal/simple-modal-type'; - /** * The rubric question submission form for a recipient. */ @@ -82,9 +81,9 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor resetHandler(): void { this.simpleModalService.openConfirmationModal( - `Reset Choices?`, + 'Reset Choices?', SimpleModalType.WARNING, - 'Are you sure you want to reset your choices? This action cannot be reverted' + 'Are you sure you want to reset your choices? This action cannot be reverted', ).result.then(() => { this.resetRubricAnswer(); }, () => {}); From 383064a2750a437af7e6cdd86a5b62e74f754226 Mon Sep 17 00:00:00 2001 From: NeoHW Date: Thu, 1 Aug 2024 02:22:53 +0800 Subject: [PATCH 15/21] Disable reset choices button past submission date --- .../rubric-question-edit-answer-form.component.html | 1 + .../rubric-question-edit-answer-form.component.ts | 7 +------ 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 7be314be80c..38e50c21ba4 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -58,6 +58,7 @@ id="btn-reset" name="button-reset" ngbTooltip="Reset current choices" + [disabled]="isDisabled" (click)="resetHandler()"> Reset choices diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts index ae90512ff67..d8c87424d23 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.ts @@ -1,4 +1,4 @@ -import { Component, Input, Output, EventEmitter } from '@angular/core'; +import { Component, Input} from '@angular/core'; import { QuestionEditAnswerFormComponent } from './question-edit-answer-form'; import { SimpleModalService } from '../../../../services/simple-modal.service'; import { @@ -32,11 +32,6 @@ export class RubricQuestionEditAnswerFormComponent extends QuestionEditAnswerFor // constant readonly RUBRIC_ANSWER_NOT_CHOSEN: number = RUBRIC_ANSWER_NOT_CHOSEN; - @Output() - resetWarningTriggered: EventEmitter = new EventEmitter(); - - showResetWarning: boolean = false; - constructor(private simpleModalService: SimpleModalService) { super(DEFAULT_RUBRIC_QUESTION_DETAILS(), DEFAULT_RUBRIC_RESPONSE_DETAILS()); } From 28fa3be3f4d4a0cbec00fd54cf34b58546928f4d Mon Sep 17 00:00:00 2001 From: NeoHW Date: Thu, 1 Aug 2024 02:24:35 +0800 Subject: [PATCH 16/21] Standardise coloring to btn-warning for reset choices --- .../rubric-question-edit-answer-form.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html index 38e50c21ba4..601be6797ca 100644 --- a/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html +++ b/src/web/app/components/question-types/question-edit-answer-form/rubric-question-edit-answer-form.component.html @@ -53,7 +53,7 @@