Skip to content

Commit

Permalink
fix(Authoring): Add lesson double click submit adds multiple lessons (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
geoffreykwan authored Jun 13, 2024
1 parent 5718031 commit 16d1ac6
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ <h5 i18n>Enter a title for the new lesson</h5>
mat-button
class="mat-raised-button mat-primary"
(click)="submit()"
[disabled]="!addLessonFormGroup.valid"
i18n
[disabled]="!addLessonFormGroup.valid || submitting"
class="button--progress"
>
Submit
<mat-progress-bar *ngIf="submitting" mode="indeterminate"/>
<ng-container i18n>Submit</ng-container>
</button>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ export class AddLessonConfigureComponent {
protected addLessonFormGroup: FormGroup = this.fb.group({
title: new FormControl('', [Validators.required])
});
protected submitting: boolean;
protected target: string;
@ViewChild('titleField') titleField: ElementRef;

Expand All @@ -32,6 +33,7 @@ export class AddLessonConfigureComponent {
}

protected submit(): void {
this.submitting = true;
const newLesson = this.projectService.createGroup(
this.addLessonFormGroup.controls['title'].value
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export abstract class ConfigureStructureComponent {
protected target: string;
private structure: any = {};
private structureDir: string = 'assets/wise5/authoringTool/structure';
protected submitting: boolean;

constructor(
private http: HttpClient,
Expand Down Expand Up @@ -58,6 +59,7 @@ export abstract class ConfigureStructureComponent {
}

protected submit(): void {
this.submitting = true;
this.structure = this.injectUniqueIds(this.structure);
this.addNodesToProject(this.structure.nodes);
const target = history.state.target;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,15 @@ <h5 i18n>Jigsaw</h5>
</button>
<span fxFlex></span>
<button mat-button color="primary" routerLink="../../.." i18n>Cancel</button>
<button mat-raised-button color="primary" (click)="submit()" i18n>Submit</button>
<button
mat-raised-button
color="primary"
(click)="submit()"
[disabled]="submitting"
class="button--progress"
>
<mat-progress-bar *ngIf="submitting" mode="indeterminate" />
<ng-container i18n>Submit</ng-container>
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,15 @@ <h5 i18n>KI Lesson with OER</h5>
</button>
<span fxFlex></span>
<button mat-button color="primary" routerLink="../../.." i18n>Cancel</button>
<button mat-raised-button color="primary" (click)="submit()" i18n>Submit</button>
<button
mat-raised-button
color="primary"
(click)="submit()"
[disabled]="submitting"
class="button--progress"
>
<mat-progress-bar *ngIf="submitting" mode="indeterminate" />
<ng-container i18n>Submit</ng-container>
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ <h5 i18n>Peer Review & Revision</h5>
</button>
<span fxFlex></span>
<button mat-button color="primary" routerLink="../../.." i18n>Cancel</button>
<button mat-raised-button color="primary" (click)="submit()" i18n>Submit</button>
<button
mat-raised-button
color="primary"
(click)="submit()"
[disabled]="submitting"
class="button--progress"
>
<mat-progress-bar *ngIf="submitting" mode="indeterminate" />
<ng-container i18n>Submit</ng-container>
</button>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,15 @@ <h5 i18n>Self-Directed Investigation</h5>
</button>
<span fxFlex></span>
<button mat-button color="primary" routerLink="../../.." i18n>Cancel</button>
<button mat-raised-button color="primary" (click)="submit()" i18n>Submit</button>
<button
mat-raised-button
color="primary"
(click)="submit()"
[disabled]="submitting"
class="button--progress"
>
<mat-progress-bar *ngIf="submitting" mode="indeterminate"/>
<ng-container i18n>Submit</ng-container>
</button>
</div>
</div>
30 changes: 15 additions & 15 deletions src/messages.xlf
Original file line number Diff line number Diff line change
Expand Up @@ -1542,6 +1542,10 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<context context-type="sourcefile">src/app/modules/shared/unlink-google-account-password/unlink-google-account-password.component.html</context>
<context context-type="linenumber">20</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/addLesson/add-lesson-configure/add-lesson-configure.component.html</context>
<context context-type="linenumber">40</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/addNode/add-your-own-node/add-your-own-node.component.html</context>
<context context-type="linenumber">77</context>
Expand All @@ -1556,19 +1560,19 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/structure/jigsaw/jigsaw.component.html</context>
<context context-type="linenumber">26</context>
<context context-type="linenumber">34</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/structure/ki-cycle-using-oer/ki-cycle-using-oer.component.html</context>
<context context-type="linenumber">17</context>
<context context-type="linenumber">25</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/structure/peer-review-and-revision/peer-review-and-revision.component.html</context>
<context context-type="linenumber">15</context>
<context context-type="linenumber">23</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/structure/self-directed-investigation/self-directed-investigation.component.html</context>
<context context-type="linenumber">16</context>
<context context-type="linenumber">24</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/components/draw/edit-draw-connected-components/edit-draw-connected-components.component.html</context>
Expand Down Expand Up @@ -9271,17 +9275,6 @@ Click &quot;Cancel&quot; to keep the invalid JSON open so you can fix it.</sourc
<context context-type="linenumber">64,66</context>
</context-group>
</trans-unit>
<trans-unit id="b570c9b6f5d96fb6f6969cb9397019829c34e82c" datatype="html">
<source> Submit </source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/authoringTool/addLesson/add-lesson-configure/add-lesson-configure.component.html</context>
<context context-type="linenumber">38,40</context>
</context-group>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/node/node.component.html</context>
<context context-type="linenumber">59,61</context>
</context-group>
</trans-unit>
<trans-unit id="891f639ffcf9d31aea80ea7e8e428a6597b059b3" datatype="html">
<source>Step Title</source>
<context-group purpose="location">
Expand Down Expand Up @@ -22089,6 +22082,13 @@ If this problem continues, let your teacher know and move on to the next activit
<context context-type="linenumber">88</context>
</context-group>
</trans-unit>
<trans-unit id="b570c9b6f5d96fb6f6969cb9397019829c34e82c" datatype="html">
<source> Submit </source>
<context-group purpose="location">
<context context-type="sourcefile">src/assets/wise5/vle/node/node.component.html</context>
<context context-type="linenumber">59,61</context>
</context-group>
</trans-unit>
<trans-unit id="e4c201ad39e5fa4658b22a707c94012bc30e0846" datatype="html">
<source>Dismiss all alerts</source>
<context-group purpose="location">
Expand Down

0 comments on commit 16d1ac6

Please sign in to comment.