Skip to content

Commit 3ecb9d9

Browse files
authored
Merge pull request #2884 from WISE-Community/issue-2875-upgrade-multiple-choice-authoring-to-angular
Upgrade Multiple Choice authoring to Angular component
2 parents e023333 + a5f1d68 commit 3ecb9d9

14 files changed

Lines changed: 490 additions & 278 deletions

src/main/webapp/site/src/app/common-hybrid-angular.module.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ import { EditorModule, TINYMCE_SCRIPT_SRC } from '@tinymce/tinymce-angular';
5656
import { WiseTinymceEditorComponent } from '../../../wise5/directives/wise-tinymce-editor/wise-tinymce-editor.component';
5757
import { MatAutocompleteModule } from '@angular/material/autocomplete';
5858
import { MatSlideToggleModule } from '@angular/material/slide-toggle';
59+
import { MatRadioModule } from '@angular/material/radio';
5960

6061
@Component({ template: `` })
6162
export class EmptyComponent {}
@@ -85,6 +86,7 @@ export class EmptyComponent {}
8586
MatListModule,
8687
MatProgressBarModule,
8788
MatProgressSpinnerModule,
89+
MatRadioModule,
8890
MatSelectModule,
8991
MatSlideToggleModule,
9092
MatTooltipModule,
@@ -142,6 +144,7 @@ export class EmptyComponent {}
142144
MatListModule,
143145
MatProgressBarModule,
144146
MatProgressSpinnerModule,
147+
MatRadioModule,
145148
MatSelectModule,
146149
MatSlideToggleModule,
147150
MatTooltipModule,

src/main/webapp/site/src/app/teacher-hybrid-angular.module.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import { EditOutsideUrlAdvancedComponent } from '../../../wise5/components/outsi
4747
import { OpenResponseAuthoring } from '../../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component';
4848
import { HtmlAuthoring } from '../../../wise5/components/html/html-authoring/html-authoring.component';
4949
import { OutsideUrlAuthoring } from '../../../wise5/components/outsideURL/outside-url-authoring/outside-url-authoring.component';
50+
import { MultipleChoiceAuthoring } from '../../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component';
5051

5152
@NgModule({
5253
declarations: [
@@ -69,6 +70,7 @@ import { OutsideUrlAuthoring } from '../../../wise5/components/outsideURL/outsid
6970
ManageStudentsComponent,
7071
MilestonesComponent,
7172
MilestoneReportDataComponent,
73+
MultipleChoiceAuthoring,
7274
NavItemProgressComponent,
7375
NodeAdvancedGeneralAuthoringComponent,
7476
NodeAdvancedJsonAuthoringComponent,

src/main/webapp/site/src/messages.xlf

Lines changed: 133 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,6 +1225,10 @@
12251225
<context context-type="sourcefile">app/student/add-project-dialog/add-project-dialog.component.html</context>
12261226
<context context-type="linenumber">30</context>
12271227
</context-group>
1228+
<context-group purpose="location">
1229+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
1230+
<context context-type="linenumber">32</context>
1231+
</context-group>
12281232
</trans-unit>
12291233
<trans-unit datatype="html" id="c04678929731aad2662284b7ce56c5c75b410df5">
12301234
<source>The unit has been successfully added to the following Google Classroom classes:</source>
@@ -6067,20 +6071,36 @@
60676071
<context context-type="sourcefile">app/authoring-tool/edit-component-tags/edit-component-tags.component.html</context>
60686072
<context context-type="linenumber">22</context>
60696073
</context-group>
6074+
<context-group purpose="location">
6075+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6076+
<context context-type="linenumber">87</context>
6077+
</context-group>
60706078
</trans-unit>
60716079
<trans-unit datatype="html" id="3a12bd96093f8972cbd9d52a68fb9178aaee4388">
60726080
<source>Move Down</source>
60736081
<context-group purpose="location">
60746082
<context context-type="sourcefile">app/authoring-tool/edit-component-tags/edit-component-tags.component.html</context>
60756083
<context context-type="linenumber">30</context>
60766084
</context-group>
6085+
<context-group purpose="location">
6086+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6087+
<context context-type="linenumber">99</context>
6088+
</context-group>
60776089
</trans-unit>
60786090
<trans-unit datatype="html" id="826b25211922a1b46436589233cb6f1a163d89b7">
60796091
<source>Delete</source>
60806092
<context-group purpose="location">
60816093
<context context-type="sourcefile">app/authoring-tool/edit-component-tags/edit-component-tags.component.html</context>
60826094
<context context-type="linenumber">38</context>
60836095
</context-group>
6096+
<context-group purpose="location">
6097+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6098+
<context context-type="linenumber">110</context>
6099+
</context-group>
6100+
<context-group purpose="location">
6101+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6102+
<context context-type="linenumber">113</context>
6103+
</context-group>
60846104
</trans-unit>
60856105
<trans-unit datatype="html" id="2485299eb70909a6cfa961bfac54f062a220806c">
60866106
<source>Component Width</source>
@@ -6096,6 +6116,119 @@
60966116
<context context-type="linenumber">20</context>
60976117
</context-group>
60986118
</trans-unit>
6119+
<trans-unit datatype="html" id="6bc7f2c14cb3141e690735b278591defe07c68fb">
6120+
<source>Prompt</source>
6121+
<context-group purpose="location">
6122+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6123+
<context context-type="linenumber">2</context>
6124+
</context-group>
6125+
<context-group purpose="location">
6126+
<context context-type="sourcefile">../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component.html</context>
6127+
<context context-type="linenumber">11</context>
6128+
</context-group>
6129+
</trans-unit>
6130+
<trans-unit datatype="html" id="495b53dee6164e1c3ec7d95ee3527bb23b62a8c2">
6131+
<source>Enter Prompt Here</source>
6132+
<context-group purpose="location">
6133+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6134+
<context context-type="linenumber">6</context>
6135+
</context-group>
6136+
<context-group purpose="location">
6137+
<context context-type="sourcefile">../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component.html</context>
6138+
<context context-type="linenumber">15</context>
6139+
</context-group>
6140+
</trans-unit>
6141+
<trans-unit datatype="html" id="5ed696b8da9ac51f371a34f2a89a753b9e18e3c0">
6142+
<source> Single Answer </source>
6143+
<context-group purpose="location">
6144+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6145+
<context context-type="linenumber">16</context>
6146+
</context-group>
6147+
</trans-unit>
6148+
<trans-unit datatype="html" id="89573ba7e055d0f1cf66d9ac94bf5f47a7ada4b2">
6149+
<source> Multiple Answer </source>
6150+
<context-group purpose="location">
6151+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6152+
<context context-type="linenumber">19</context>
6153+
</context-group>
6154+
</trans-unit>
6155+
<trans-unit datatype="html" id="51e09577ccc3a404bf3aa3bf88c6d5398135803b">
6156+
<source> There are no choices. Click the "Add Choice" button to add a choice. </source>
6157+
<context-group purpose="location">
6158+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6159+
<context context-type="linenumber">37</context>
6160+
</context-group>
6161+
</trans-unit>
6162+
<trans-unit datatype="html" id="3f2b2b4a6ec318a31f7f5f9b526480846a27547a">
6163+
<source>Choice Text</source>
6164+
<context-group purpose="location">
6165+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6166+
<context context-type="linenumber">44</context>
6167+
</context-group>
6168+
</trans-unit>
6169+
<trans-unit datatype="html" id="6b4a8fd4b52fd563b4963ab19f34658e069382d7">
6170+
<source>Type text or choose an image</source>
6171+
<context-group purpose="location">
6172+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6173+
<context context-type="linenumber">49</context>
6174+
</context-group>
6175+
</trans-unit>
6176+
<trans-unit datatype="html" id="ac7627de4d6171adbfba4d934025c8c39debc469">
6177+
<source>Choose an Image</source>
6178+
<context-group purpose="location">
6179+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6180+
<context context-type="linenumber">56</context>
6181+
</context-group>
6182+
</trans-unit>
6183+
<trans-unit datatype="html" id="a5f9ba9bb9faa8284bcadb1cdbc6aaf969e9c4bb">
6184+
<source>Image</source>
6185+
<context-group purpose="location">
6186+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6187+
<context context-type="linenumber">59</context>
6188+
</context-group>
6189+
</trans-unit>
6190+
<trans-unit datatype="html" id="946344604c321ff0c86a78f6e047f9142b309dd1">
6191+
<source> Is Correct </source>
6192+
<context-group purpose="location">
6193+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6194+
<context context-type="linenumber">67</context>
6195+
</context-group>
6196+
</trans-unit>
6197+
<trans-unit datatype="html" id="4488359b3a14b99b193ac292e1f16ee47766ab8b">
6198+
<source>Is Correct</source>
6199+
<context-group purpose="location">
6200+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6201+
<context context-type="linenumber">66</context>
6202+
</context-group>
6203+
</trans-unit>
6204+
<trans-unit datatype="html" id="e29c5e189e57e8d8dc3f52df4abe7bce4bfca53c">
6205+
<source>Feeback</source>
6206+
<context-group purpose="location">
6207+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6208+
<context context-type="linenumber">74</context>
6209+
</context-group>
6210+
</trans-unit>
6211+
<trans-unit datatype="html" id="5317cde482fdb766008de3e1ae09cf0610366abc">
6212+
<source>Optional</source>
6213+
<context-group purpose="location">
6214+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6215+
<context context-type="linenumber">79</context>
6216+
</context-group>
6217+
</trans-unit>
6218+
<trans-unit datatype="html" id="b7cd4598b947ef99d3603c8a026a57b821786785">
6219+
<source>Up</source>
6220+
<context-group purpose="location">
6221+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6222+
<context context-type="linenumber">90</context>
6223+
</context-group>
6224+
</trans-unit>
6225+
<trans-unit datatype="html" id="c52c8626a9b546aa3859aa0a2e58221e27285cee">
6226+
<source>Down</source>
6227+
<context-group purpose="location">
6228+
<context context-type="sourcefile">../../wise5/components/multipleChoice/multiple-choice-authoring/multiple-choice-authoring.component.html</context>
6229+
<context context-type="linenumber">102</context>
6230+
</context-group>
6231+
</trans-unit>
60996232
<trans-unit datatype="html" id="6817513ddcee06a7cb2a7b2708e5616b861db81c">
61006233
<source><x equiv-text="{{nodeCompletion}}" id="INTERPOLATION"/>% completed (All periods)</source>
61016234
<context-group purpose="location">
@@ -6138,20 +6271,6 @@
61386271
<context context-type="linenumber">7</context>
61396272
</context-group>
61406273
</trans-unit>
6141-
<trans-unit datatype="html" id="6bc7f2c14cb3141e690735b278591defe07c68fb">
6142-
<source>Prompt</source>
6143-
<context-group purpose="location">
6144-
<context context-type="sourcefile">../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component.html</context>
6145-
<context context-type="linenumber">11</context>
6146-
</context-group>
6147-
</trans-unit>
6148-
<trans-unit datatype="html" id="495b53dee6164e1c3ec7d95ee3527bb23b62a8c2">
6149-
<source>Enter Prompt Here</source>
6150-
<context-group purpose="location">
6151-
<context context-type="sourcefile">../../wise5/components/openResponse/open-response-authoring/open-response-authoring.component.html</context>
6152-
<context context-type="linenumber">15</context>
6153-
</context-group>
6154-
</trans-unit>
61556274
<trans-unit datatype="html" id="2e0e07912515c250498d28841610709033392606">
61566275
<source> Show Open Education Resources </source>
61576276
<context-group purpose="location">

src/main/webapp/site/src/style/themes/_apps.scss

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,12 +61,8 @@ $subhead-font-size-base: rem(1.600) !default;
6161
white-space: nowrap;
6262
}
6363

64-
// TODO: remove once bootstrap dependency is removed
6564
label {
66-
font-weight: 500 !important;
67-
display: inherit;
68-
max-width: none;
69-
margin-bottom: 0;
65+
font-weight: 500;
7066
}
7167

7268
.transform--none {

src/main/webapp/wise5/authoringTool/components/component-authoring.component.ts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Directive, Input } from '@angular/core';
22
import { Subject, Subscription } from 'rxjs';
33
import { debounceTime, distinctUntilChanged } from 'rxjs/operators';
4+
import { ProjectAssetService } from '../../../site/src/app/services/projectAssetService';
45
import { ConfigService } from '../../services/configService';
56
import { NodeService } from '../../services/nodeService';
67
import { TeacherProjectService } from '../../services/teacherProjectService';
@@ -31,6 +32,7 @@ export abstract class ComponentAuthoring {
3132
constructor(
3233
protected ConfigService: ConfigService,
3334
protected NodeService: NodeService,
35+
protected ProjectAssetService: ProjectAssetService,
3436
protected ProjectService: TeacherProjectService
3537
) {
3638
this.promptChange
@@ -85,4 +87,27 @@ export abstract class ComponentAuthoring {
8587
}
8688

8789
saveStarterState(starterState: any): void {}
90+
91+
setShowSubmitButtonValue(show: boolean): void {
92+
if (show == null || show == false) {
93+
this.authoringComponentContent.showSaveButton = false;
94+
this.authoringComponentContent.showSubmitButton = false;
95+
} else {
96+
this.authoringComponentContent.showSaveButton = true;
97+
this.authoringComponentContent.showSubmitButton = true;
98+
}
99+
this.NodeService.broadcastComponentShowSubmitButtonValueChanged({
100+
nodeId: this.nodeId,
101+
componentId: this.componentId,
102+
showSubmitButton: show
103+
});
104+
}
105+
106+
openAssetChooser(params: any): any {
107+
return this.ProjectAssetService.openAssetChooser(params).then((data: any) => {
108+
return this.assetSelected(data);
109+
});
110+
}
111+
112+
assetSelected({ nodeId, componentId, assetItem, target }): void {}
88113
}

src/main/webapp/wise5/components/html/html-authoring/html-authoring.component.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { Component } from '@angular/core';
2+
import { ProjectAssetService } from '../../../../site/src/app/services/projectAssetService';
23
import { ComponentAuthoring } from '../../../authoringTool/components/component-authoring.component';
34
import { ConfigService } from '../../../services/configService';
45
import { NodeService } from '../../../services/nodeService';
@@ -15,10 +16,11 @@ export class HtmlAuthoring extends ComponentAuthoring {
1516
constructor(
1617
protected ConfigService: ConfigService,
1718
protected NodeService: NodeService,
19+
protected ProjectAssetService: ProjectAssetService,
1820
protected ProjectService: TeacherProjectService,
1921
protected UtilService: UtilService
2022
) {
21-
super(ConfigService, NodeService, ProjectService);
23+
super(ConfigService, NodeService, ProjectAssetService, ProjectService);
2224
}
2325

2426
ngOnInit() {

0 commit comments

Comments
 (0)