Skip to content
Snippets Groups Projects
Commit 3908bc23 authored by Thomas Lenz's avatar Thomas Lenz
Browse files

Use matdialog to copy roomId into content-creator-component

parent eb0a0706
1 merge request!75Resolve "content creation (text) followup"
Pipeline #13416 passed with stage
in 34 seconds
<form (ngSubmit)="addContent(subjectTitle.value, bodyText.value, contentRound.value)">
<form (ngSubmit)="addContent(subjectTitle.value, bodyText.value)">
<div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px">
<mat-form-field>
<input class="input-block" #subjectTitle matInput (keypress)="resetEmptyInputs()" placeholder="Subject" [(ngModel)]="subject"
......@@ -7,10 +7,6 @@
<mat-icon>close</mat-icon>
</button>
</mat-form-field>
<mat-form-field>
<input class="input-block" #contentRound matInput (keypress)="resetEmptyInputs()" placeholder="Round" [(ngModel)]="round"
name="Round">
</mat-form-field>
<mat-form-field>
<textarea #bodyText matInput matTextareaAutosize matAutosizeMinRows="3" matAutosizeMaxRows="8" (keypress)="resetEmptyInputs()"
placeholder="Body" [(ngModel)]="body" name="Text"></textarea>
......
......@@ -14,15 +14,15 @@ import { RoomComponent } from '../room/room.component';
export class ContentCreationComponent implements OnInit {
subject: string;
body: string;
roomId: string;
emptyInputs = false;
constructor(
private contentService: ContentService,
private router: Router,
private notification: NotificationService,
public dialogRef: MatDialogRef<RoomComponent>,
@Inject(MAT_DIALOG_DATA) public data: any
) { }
constructor(private contentService: ContentService,
private router: Router,
private notification: NotificationService,
public dialogRef: MatDialogRef<RoomComponent>,
@Inject(MAT_DIALOG_DATA) public data: any) {
}
onNoClick(): void {
this.dialogRef.close();
......@@ -42,7 +42,7 @@ export class ContentCreationComponent implements OnInit {
this.emptyInputs = true;
return;
}
this.contentService.addContent({ subject: subject, body: body } as Content)
this.contentService.addContent({ subject: subject, body: body, roomId: this.roomId } as Content)
.subscribe(content => {
this.notification.show(`Content '${content.subject}' successfully created.`);
this.router.navigate([`/creator/room/${content.roomId}/${content.id}`]);
......
......@@ -62,9 +62,10 @@ export class CreatorRoomComponent extends RoomComponent implements OnInit {
}
createContentDialog(): void {
this.dialog.open(ContentCreationComponent, {
const dialogRef = this.dialog.open(ContentCreationComponent, {
width: '350px'
});
dialogRef.componentInstance.roomId = this.room.id;
}
confirmDeletion(dialogAnswer: string): void {
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment