diff --git a/src/app/content-creation/content-creation.component.html b/src/app/content-creation/content-creation.component.html index 65367aae4ecbd7868aad649d8c440ed7e2440113..2e435d223b65946b72248579b43cd2780a0a3bc3 100644 --- a/src/app/content-creation/content-creation.component.html +++ b/src/app/content-creation/content-creation.component.html @@ -1,23 +1,12 @@ -<form (ngSubmit)="addContent(subjectTitle.value, bodyText.value, roomIdNum.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> - </mat-form-field> - <mat-form-field> - <input class="input-block" #roomIdNum matInput (keypress)="resetEmptyInputs()" placeholder="Room Id" [(ngModel)]="roomId" - name="Title"> - <button mat-button *ngIf="roomId" type="text" matSuffix mat-icon-button aria-label="Clear" (click)="roomId=''"> - <mat-icon>close</mat-icon> - </button> + <input class="input-block" #subjectTitle matInput (keypress)="resetEmptyInputs()" placeholder="Subject" [(ngModel)]="subject"> </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> @@ -25,6 +14,7 @@ <mat-slide-toggle>Allow absention</mat-slide-toggle> <mat-slide-toggle>Show hints</mat-slide-toggle> </div> - <button mat-raised-button color="primary" type="submit">Create content</button> + <button mat-raised-button color="primary" type="submit">Create content + </button> </div> </form> diff --git a/src/app/content-creation/content-creation.component.ts b/src/app/content-creation/content-creation.component.ts index 87f678cc71e54525daec7ce6eef9ed9aa10e78ef..6ec523824cb8e7c36a608f7bc853b1b8d6142575 100644 --- a/src/app/content-creation/content-creation.component.ts +++ b/src/app/content-creation/content-creation.component.ts @@ -16,7 +16,6 @@ export class ContentCreationComponent implements OnInit { body: string; roomId: string; emptyInputs = false; - constructor( private contentService: ContentService, private router: Router, @@ -36,15 +35,14 @@ export class ContentCreationComponent implements OnInit { this.emptyInputs = false; } - addContent(subject: string, body: string, roomId: string) { + addContent(subject: string, body: string) { subject = subject.trim(); body = body.trim(); - roomId = roomId.trim(); - if (!subject || !body || !roomId) { + if (!subject || !body) { this.emptyInputs = true; return; } - this.contentService.addContent({ subject: subject, body: body , roomId: roomId } as Content) + this.contentService.addContent({ subject: subject, body: body, this.roomId } as Content) .subscribe(content => { this.notification.show(`Content '${content.subject}' successfully created.`); this.router.navigate([`/creator/room/${content.roomId}/${content.id}`]); diff --git a/src/app/creator-room/creator-room.component.html b/src/app/creator-room/creator-room.component.html index 900188f92d49c5ed3f8e56c8e2edb3eea6092fb2..051dc5d43a5e3d0a4157a547fa19320efed8b1aa 100644 --- a/src/app/creator-room/creator-room.component.html +++ b/src/app/creator-room/creator-room.component.html @@ -69,4 +69,4 @@ </mat-card> <div *ngIf="!isLoading && !room">Error: room could not be found!</div> </div> -</div> \ No newline at end of file +</div> diff --git a/src/app/creator-room/creator-room.component.ts b/src/app/creator-room/creator-room.component.ts index 06990d855dd1b222b2aabc5793d6733c49b963c2..8978b5b82aff17159b7dee566a6870dc2540da31 100644 --- a/src/app/creator-room/creator-room.component.ts +++ b/src/app/creator-room/creator-room.component.ts @@ -22,8 +22,9 @@ export class CreatorRoomComponent extends RoomComponent implements OnInit { constructor(protected roomService: RoomService, protected notification: NotificationService, protected route: ActivatedRoute, - public dialog: MatDialog, - protected location: Location) { + protected location: Location, + public dialog: MatDialog + ) { super(roomService, route, location); }