Skip to content
Snippets Groups Projects
Commit 909a16b8 authored by Heinrich Marks's avatar Heinrich Marks :hibiscus: Committed by Thomas Lenz
Browse files

Improve content creation html % logic

parent 0a6b13e2
No related merge requests found
<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"
name="Title">
<button mat-button *ngIf="subject" type="text" matSuffix mat-icon-button aria-label="Clear" (click)="subject=''">
<mat-icon>close</mat-icon>
</button>
<input class="input-block" #subjectTitle matInput (keypress)="resetEmptyInputs()" placeholder="Subject" [(ngModel)]="subject">
</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>
<button mat-button *ngIf="body" type="text" matSuffix mat-icon-button aria-label="Clear" (click)="body=''">
<input class="input-block" #bodyText matInput matTextareaAutosize matAutosizeMinRows="3" matAutosizeMaxRows="8" (keypress)="resetEmptyInputs()"
placeholder="Body" [(ngModel)]="body">
<button mat-button matSuffix mat-icon-button aria-label="Clear" (click)="subject=''; body=''">
<mat-icon>close</mat-icon>
</button>
</mat-form-field>
......
......@@ -14,8 +14,8 @@ 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,
......@@ -42,7 +42,7 @@ export class ContentCreationComponent implements OnInit {
this.emptyInputs = true;
return;
}
this.contentService.addContent({ subject: subject, body: body, this.roomId } as Content)
this.contentService.addContent({ subject: subject, body: body } as Content)
.subscribe(content => {
this.notification.show(`Content '${content.subject}' successfully created.`);
this.router.navigate([`/creator/room/${content.roomId}/${content.id}`]);
......
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