Loading src/app/review/notebooks/notebooks.component.html +8 −3 Original line number Diff line number Diff line Loading @@ -4,19 +4,19 @@ <div class="header"> <hr> <h4>IS Notebooks: <span style="font-weight: bold">{{loggedInUser?.name}}</span> ({{loggedInUser?.uco}}) | <span style="font-weight: bold">{{submission?.course?.codename}}</span> </h4> <h4>IS Notebooks: <span style="font-weight: bold">{{submission?.user?.name}}</span> ({{loggedInUser?.uco}}) | <span style="font-weight: bold">{{submission?.course?.codename}}</span> </h4> </div> <div class="pt-2"> <div *ngIf="notebook == null"> <div class="alert alert-light" role="alert" style="background: #EDF1F4"> The notebook for student {{loggedInUser?.name}} and course {{submission?.course?.codename}} is empty. The notebook for student {{submission?.user?.name}} and course {{submission?.course?.codename}} is empty. </div> </div> <div *ngIf="notebook !== null"> <hr> <span><button type="button" class="btn btn-outline-primary" data-toggle="modal" data-target=".bd-example-modal-xl" (click)="initEditNotebookForm()">Edit notebook</button></span> {{notebook[loggedInUser?.uco]}} {{notebook[submission?.user?.uco]}} </div> </div> </div> Loading @@ -35,5 +35,10 @@ </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" (click)="updateNotebook()" data-dismiss="modal">Save changes</button> </div> </div> </div> </div> src/app/review/notebooks/notebooks.component.ts +9 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,18 @@ export class NotebooksComponent implements OnInit { } private initEditNotebookForm() { if (this.notebook && this.loggedInUser) { if (this.notebook && this.submission) { this.editNotebookForm.setValue({ content: this.notebook[this.loggedInUser.uco] content: this.notebook[this.submission.user.uco] }); } } private updateNotebook() { const content = this.editNotebookForm.value['content']; this.subscriptions.push(this.notebookService.postNotebook(this.submission.id, content).subscribe( () => { console.log('Updated the IS notebook content', content); })); } } Loading
src/app/review/notebooks/notebooks.component.html +8 −3 Original line number Diff line number Diff line Loading @@ -4,19 +4,19 @@ <div class="header"> <hr> <h4>IS Notebooks: <span style="font-weight: bold">{{loggedInUser?.name}}</span> ({{loggedInUser?.uco}}) | <span style="font-weight: bold">{{submission?.course?.codename}}</span> </h4> <h4>IS Notebooks: <span style="font-weight: bold">{{submission?.user?.name}}</span> ({{loggedInUser?.uco}}) | <span style="font-weight: bold">{{submission?.course?.codename}}</span> </h4> </div> <div class="pt-2"> <div *ngIf="notebook == null"> <div class="alert alert-light" role="alert" style="background: #EDF1F4"> The notebook for student {{loggedInUser?.name}} and course {{submission?.course?.codename}} is empty. The notebook for student {{submission?.user?.name}} and course {{submission?.course?.codename}} is empty. </div> </div> <div *ngIf="notebook !== null"> <hr> <span><button type="button" class="btn btn-outline-primary" data-toggle="modal" data-target=".bd-example-modal-xl" (click)="initEditNotebookForm()">Edit notebook</button></span> {{notebook[loggedInUser?.uco]}} {{notebook[submission?.user?.uco]}} </div> </div> </div> Loading @@ -35,5 +35,10 @@ </div> </form> </div> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button> <button type="button" class="btn btn-primary" (click)="updateNotebook()" data-dismiss="modal">Save changes</button> </div> </div> </div> </div>
src/app/review/notebooks/notebooks.component.ts +9 −2 Original line number Diff line number Diff line Loading @@ -47,11 +47,18 @@ export class NotebooksComponent implements OnInit { } private initEditNotebookForm() { if (this.notebook && this.loggedInUser) { if (this.notebook && this.submission) { this.editNotebookForm.setValue({ content: this.notebook[this.loggedInUser.uco] content: this.notebook[this.submission.user.uco] }); } } private updateNotebook() { const content = this.editNotebookForm.value['content']; this.subscriptions.push(this.notebookService.postNotebook(this.submission.id, content).subscribe( () => { console.log('Updated the IS notebook content', content); })); } }