From e3b459cf38adcb138e6600128dd641cb2434fb11 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 5 May 2026 15:54:47 -0700 Subject: [PATCH 1/5] Add button to allow adding new choices at any position. Before, it only let you add a new choice at the end --- .../add-mc-choice.component.html | 17 ++++++++++ .../add-mc-choice.component.scss | 26 +++++++++++++++ .../add-mc-choice/add-mc-choice.component.ts | 17 ++++++++++ .../multiple-choice-authoring.component.html | 23 ++++++------- .../multiple-choice-authoring.component.scss | 6 ---- .../multiple-choice-authoring.component.ts | 10 ++++-- .../multiple-choice-authoring.harness.ts | 4 ++- src/messages.xlf | 32 +++++++++++-------- 8 files changed, 99 insertions(+), 36 deletions(-) create mode 100644 src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.html create mode 100644 src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.scss create mode 100644 src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.ts diff --git a/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.html b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.html new file mode 100644 index 00000000000..a6d8497e139 --- /dev/null +++ b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.html @@ -0,0 +1,17 @@ +
+ + +
diff --git a/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.scss b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.scss new file mode 100644 index 00000000000..acbff0be900 --- /dev/null +++ b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.scss @@ -0,0 +1,26 @@ +.choice-divider { + width: 100%; + position: relative; + + &:after { + position: absolute; + bottom: 0; + left: 0; + width: 100%; + border-bottom-style: solid; + content: ""; + border-bottom-width: var(--mdc-filled-text-field-focus-active-indicator-height); + border-bottom-color: var(--mdc-filled-text-field-focus-active-indicator-color); + transform: scaleX(0); + transform-origin: 100%; + transition: transform 360ms cubic-bezier(0.4, 0, 0.2, 1),opacity 360ms cubic-bezier(0.4, 0, 0.2, 1); + opacity: 0; + } + + &.active { + &:after { + transform: scaleX(1); + opacity: 1; + } + } +} \ No newline at end of file diff --git a/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.ts b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.ts new file mode 100644 index 00000000000..ad438bfbd9e --- /dev/null +++ b/src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.ts @@ -0,0 +1,17 @@ +import { CommonModule } from '@angular/common'; +import { Component, EventEmitter, Output } from '@angular/core'; +import { MatButtonModule } from '@angular/material/button'; +import { MatDividerModule } from '@angular/material/divider'; +import { MatIconModule } from '@angular/material/icon'; +import { MatTooltipModule } from '@angular/material/tooltip'; + +@Component({ + imports: [CommonModule, MatButtonModule, MatDividerModule, MatIconModule, MatTooltipModule], + selector: 'add-mc-choice', + styleUrl: 'add-mc-choice.component.scss', + templateUrl: 'add-mc-choice.component.html' +}) +export class AddMCChoiceComponent { + protected focus: boolean; + @Output() newChoiceEvent: EventEmitter = new EventEmitter(); +} diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html index 7fbc93ae133..f0561be6cbb 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html @@ -14,23 +14,19 @@

Choices - + @if (componentContent.choices == null || componentContent.choices.length === 0) {
- There are no choices. Click the "Add Choice" button to add a choice. + There are no choices. Click the "Add choice" button to add a choice.
} -@for (choice of componentContent.choices; track choice.id; let last = $last; let first = $first) { +@for ( + choice of componentContent.choices; + track choice.id; + let last = $last; + let first = $first; + let index = $index +) {
+ } diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.scss b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.scss index d2d12f4843f..dbf1e1d33bd 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.scss +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.scss @@ -13,15 +13,9 @@ label.mat-radio-label { margin-right: 10px; } -.add-choice-button { - margin-top: 20px; - margin-bottom: 20px; -} - .choice-container { border: 2px solid #dddddd; border-radius: variables.$card-border-radius; - margin-bottom: 20px; padding: 20px 20px 10px 20px; } diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.ts index 6bc4e51546c..6147a085893 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.ts +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.ts @@ -14,9 +14,11 @@ import { EditComponentPrompt } from '../../../../../app/authoring-tool/edit-comp import { TranslatableAssetChooserComponent } from '../../../authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component'; import { TranslatableInputComponent } from '../../../authoringTool/components/translatable-input/translatable-input.component'; import { Choice } from '../Choice'; +import { AddMCChoiceComponent } from '../add-mc-choice/add-mc-choice.component'; @Component({ imports: [ + AddMCChoiceComponent, FormsModule, MatButtonModule, MatCheckboxModule, @@ -67,8 +69,12 @@ export class MultipleChoiceAuthoring extends AbstractComponentAuthoring { return false; } - protected addChoice(): void { - this.componentContent.choices.push(new Choice(generateRandomKey(), '', false, '')); + protected addChoice(position: number): void { + this.componentContent.choices.splice( + position, + 0, + new Choice(generateRandomKey(), '', false, '') + ); this.componentChanged(); } diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts index 79fc10dd469..bd31240bb38 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts @@ -4,7 +4,9 @@ import { MatRadioButtonHarness } from '@angular/material/radio/testing'; export class MultipleChoiceAuthoringHarness extends ComponentHarness { static hostSelector = 'multiple-choice-authoring'; - getAddChoiceButton = this.locatorFor(MatButtonHarness.with({ selector: '.add-choice-button' })); + getAddChoiceButton = this.locatorFor( + MatButtonHarness.with({ selector: '[mattooltip="Add choice"]' }) + ); getChoices = this.locatorForAll('.choice-container'); getDeleteChoiceButtons = this.locatorForAll( MatButtonHarness.with({ selector: '[mattooltip="Delete"]' }) diff --git a/src/messages.xlf b/src/messages.xlf index 48c96855a13..51be42b6c62 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -649,7 +649,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 84,86 + 80,82 src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html @@ -700,7 +700,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 95,98 + 91,94 src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html @@ -803,7 +803,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 107,109 + 103,105 src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html @@ -10607,7 +10607,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 69,72 + 65,68 src/assets/wise5/directives/componentAnnotations/component-annotations.component.ts @@ -11672,7 +11672,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 16,20 + 16,18 @@ -11683,7 +11683,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 58,63 + 54,59 @@ -21104,6 +21104,10 @@ Warning: This will delete all existing choices and buckets in this activity.src/assets/wise5/components/match/match-authoring/match-authoring.component.html 45,49 + + src/assets/wise5/components/multipleChoice/add-mc-choice/add-mc-choice.component.html + 12,16 + There are no choices. Click the "Add choice" button to add a choice. @@ -21131,7 +21135,7 @@ Warning: This will delete all existing choices and buckets in this activity. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 41,43 + 37,39 @@ -21233,7 +21237,7 @@ Warning: This will delete all existing choices and buckets in this activity. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.ts - 76 + 82 @@ -21414,32 +21418,32 @@ Warning: This will delete all existing choices in this activity. 36 - - There are no choices. Click the "Add Choice" button to add a choice. + + There are no choices. Click the "Add choice" button to add a choice. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 30,33 + 20,25 Choice Text src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 39,42 + 35,38 Is Correct src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 61,65 + 57,61 Optional src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 71,73 + 67,69 From 2ca3665d9cf2f8705c911a582b3a8120822fcce5 Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 5 May 2026 20:06:15 -0700 Subject: [PATCH 2/5] Moved move up/down buttons to the right of the choices, similar to moving components up/down in node editing view --- .../multiple-choice-authoring.component.html | 163 +++++++++--------- .../multiple-choice-authoring.harness.ts | 4 +- .../multiple-choice-authoring.spec.ts | 2 +- src/messages.xlf | 32 ++-- 4 files changed, 101 insertions(+), 100 deletions(-) diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html index f0561be6cbb..dbde97e5393 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html @@ -20,91 +20,92 @@ There are no choices. Click the "Add choice" button to add a choice. } -@for ( - choice of componentContent.choices; - track choice.id; - let last = $last; - let first = $first; - let index = $index -) { -
-
- - -
- +
+
+ + +
+ + Is Correct + +
+
+
+ + +
-
- - - - +
+ @if (i > 0) { + + } + @if (!last) { + + }
- + } diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts index bd31240bb38..1e102de3b02 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts @@ -12,10 +12,10 @@ export class MultipleChoiceAuthoringHarness extends ComponentHarness { MatButtonHarness.with({ selector: '[mattooltip="Delete"]' }) ); getMoveDownButtons = this.locatorForAll( - MatButtonHarness.with({ selector: '[mattooltip="Move Down"]' }) + MatButtonHarness.with({ selector: '[mattooltip="Move down"]' }) ); getMoveUpButtons = this.locatorForAll( - MatButtonHarness.with({ selector: '[mattooltip="Move Up"]' }) + MatButtonHarness.with({ selector: '[mattooltip="Move up"]' }) ); getMultipleAnswerRadioChoice = this.locatorFor( MatRadioButtonHarness.with({ label: 'Multiple Answer' }) diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.spec.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.spec.ts index 238542141dc..3bb049078ba 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.spec.ts +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.spec.ts @@ -120,7 +120,7 @@ function moveChoice() { }); describe('move choice up is clicked on the second choice', () => { it('moves the choice up', async () => { - await (await multipleChoiceAuthoringHarness.getMoveChoiceUpButton(1)).click(); + await (await multipleChoiceAuthoringHarness.getMoveChoiceUpButton(0)).click(); expectChoiceOrder(['choice2', 'choice1']); }); }); diff --git a/src/messages.xlf b/src/messages.xlf index 51be42b6c62..4cda9701357 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -647,10 +647,6 @@ src/assets/wise5/components/graph/graph-authoring/graph-authoring.component.html 561,563 - - src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 80,82 - src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html 169,171 @@ -698,10 +694,6 @@ src/assets/wise5/components/graph/graph-authoring/graph-authoring.component.html 574,577 - - src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 91,94 - src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html 182,185 @@ -803,7 +795,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 103,105 + 75,77 src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html @@ -1306,6 +1298,10 @@ src/assets/wise5/components/match/match-authoring/match-authoring.component.html 170,173 + + src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html + 90,92 + Move down @@ -1337,6 +1333,10 @@ src/assets/wise5/components/match/match-authoring/match-authoring.component.html 181,185 + + src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html + 102,105 + Add a new rule at the end @@ -10607,7 +10607,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 65,68 + 60,63 src/assets/wise5/directives/componentAnnotations/component-annotations.component.ts @@ -11683,7 +11683,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 54,59 + 49,53 @@ -21135,7 +21135,7 @@ Warning: This will delete all existing choices and buckets in this activity. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 37,39 + 32,34 @@ -21422,28 +21422,28 @@ Warning: This will delete all existing choices in this activity. There are no choices. Click the "Add choice" button to add a choice. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 20,25 + 20,23 Choice Text src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 35,38 + 30,32 Is Correct src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 57,61 + 52,56 Optional src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 67,69 + 62,64 From 4b66473e82dda757648260bb4c0711db4278048f Mon Sep 17 00:00:00 2001 From: Hiroki Terashima Date: Tue, 5 May 2026 20:18:25 -0700 Subject: [PATCH 3/5] Move delete choice button to the top right corner of the choice box --- .../multiple-choice-authoring.component.html | 46 +++++++++---------- .../multiple-choice-authoring.harness.ts | 2 +- src/messages.xlf | 20 ++++---- 3 files changed, 33 insertions(+), 35 deletions(-) diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html index dbde97e5393..d42e1528458 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html @@ -40,18 +40,28 @@ [processAsset]="processSelectedAsset" (defaultLanguageTextChanged)="componentChanged()" /> -
- - Is Correct - -
+ + Is Correct + +
+
- -
diff --git a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts index 1e102de3b02..41900bdab04 100644 --- a/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts +++ b/src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.harness.ts @@ -9,7 +9,7 @@ export class MultipleChoiceAuthoringHarness extends ComponentHarness { ); getChoices = this.locatorForAll('.choice-container'); getDeleteChoiceButtons = this.locatorForAll( - MatButtonHarness.with({ selector: '[mattooltip="Delete"]' }) + MatButtonHarness.with({ selector: '[mattooltip="Delete choice"]' }) ); getMoveDownButtons = this.locatorForAll( MatButtonHarness.with({ selector: '[mattooltip="Move down"]' }) diff --git a/src/messages.xlf b/src/messages.xlf index 4cda9701357..fe348ee68fe 100644 --- a/src/messages.xlf +++ b/src/messages.xlf @@ -793,10 +793,6 @@ src/assets/wise5/components/label/label-student/label-student.component.html 43,46 - - src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 75,77 - src/assets/wise5/components/summary/summary-authoring/summary-authoring.component.html 196,198 @@ -1300,7 +1296,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 90,92 + 88,90 @@ -1335,7 +1331,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 102,105 + 100,103 @@ -10607,7 +10603,7 @@ src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 60,63 + 70,73 src/assets/wise5/directives/componentAnnotations/component-annotations.component.ts @@ -11683,7 +11679,7 @@ Click "Cancel" to keep the invalid JSON open so you can fix it. src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 49,53 + 48,53 @@ -21144,6 +21140,10 @@ Warning: This will delete all existing choices and buckets in this activity.src/assets/wise5/components/match/match-authoring/match-authoring.component.html 105,109 + + src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html + 60,63 + Source bucket name @@ -21436,14 +21436,14 @@ Warning: This will delete all existing choices in this activity. Is Correct src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 52,56 + 51,54 Optional src/assets/wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html - 62,64 + 72,74 From bcee6ed8d82ec6e1abf7d0af05df11880312285e Mon Sep 17 00:00:00 2001 From: Jonathan Lim-Breitbart Date: Mon, 11 May 2026 13:13:43 -0700 Subject: [PATCH 4/5] Clean up styles and layout; improve responsiveness --- .../translatable-asset-chooser.component.html | 2 +- .../multiple-choice-authoring.component.html | 90 +++++++++---------- .../multiple-choice-authoring.component.scss | 38 +------- 3 files changed, 50 insertions(+), 80 deletions(-) diff --git a/src/assets/wise5/authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component.html b/src/assets/wise5/authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component.html index 4fd2401a8ac..c2f4225535e 100644 --- a/src/assets/wise5/authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component.html +++ b/src/assets/wise5/authoringTool/components/translatable-asset-chooser/translatable-asset-chooser.component.html @@ -1,6 +1,6 @@ +
+
+
+
+ + +
+
+ + Is Correct + + +
@@ -81,7 +83,6 @@