11import { CommonModule } from '@angular/common' ;
2- import { Component , EventEmitter , Input , OnInit , Output } from '@angular/core' ;
2+ import { Component , inject , Input , OnInit } from '@angular/core' ;
33import { Component as WISEComponent } from '../../../common/Component' ;
44import { TeacherSummaryDisplayComponent } from '../teacher-summary-display.component' ;
55import { ComponentFactory } from '../../../common/ComponentFactory' ;
66import { DiscussionTeacherComponent } from '../../../components/discussion/discussion-teacher/discussion-teacher.component' ;
77import { MatSlideToggle } from '@angular/material/slide-toggle' ;
88import { FormsModule } from '@angular/forms' ;
9+ import { TEACHER_SUMMARY_CONFIG } from '../TeacherSummaryConfig' ;
910
1011@Component ( {
1112 imports : [ CommonModule , DiscussionTeacherComponent , FormsModule , MatSlideToggle ] ,
@@ -15,11 +16,7 @@ import { FormsModule } from '@angular/forms';
1516 <div [class.expanded]="expanded">
1617 <h2 class="mat-subtitle-1" i18n>Class Discussion</h2>
1718 <div class="mb-4 flex flex-wrap gap-4 justify-between items-center">
18- <mat-slide-toggle
19- [(ngModel)]="anonymizeResponses"
20- (change)="anonymizeResponsesChanged()"
21- i18n
22- >
19+ <mat-slide-toggle [(ngModel)]="teacherSummaryConfig.anonymizeStudentNames" i18n>
2320 Hide student names
2421 </mat-slide-toggle>
2522 @if (component.content.anonymizeResponses) {
@@ -34,25 +31,21 @@ import { FormsModule } from '@angular/forms';
3431 [nodeId]="nodeId"
3532 [component]="component"
3633 [periodId]="periodId"
37- [anonymizeResponses]="anonymizeResponses "
34+ [anonymizeResponses]="teacherSummaryConfig.anonymizeStudentNames "
3835 [mode]="'summary'"
3936 />
4037 </div>
4138 `
4239} )
4340export class DiscussionSummaryComponent extends TeacherSummaryDisplayComponent implements OnInit {
44- @Input ( ) anonymizeResponses : boolean ;
4541 protected component : WISEComponent ;
4642 @Input ( ) expanded : boolean ;
47- @Output ( ) anonymizeResponsesChange = new EventEmitter < boolean > ( ) ;
43+
44+ protected teacherSummaryConfig = inject ( TEACHER_SUMMARY_CONFIG ) ;
4845
4946 ngOnInit ( ) : void {
5047 let content = this . projectService . getComponent ( this . nodeId , this . componentId ) ;
5148 content = this . projectService . injectAssetPaths ( content ) ;
5249 this . component = new ComponentFactory ( ) . getComponent ( content , this . nodeId ) ;
5350 }
54-
55- protected anonymizeResponsesChanged ( ) {
56- this . anonymizeResponsesChange . emit ( this . anonymizeResponses ) ;
57- }
5851}
0 commit comments