diff --git a/src/app/components/dialogs/room-create/room-create.component.html b/src/app/components/dialogs/room-create/room-create.component.html index 5ee9f7fbc2cd13c531ea00f6e11300cc79720931..8ee98a5bbb36611cde23b6d03b7337a61b2ac3e3 100644 --- a/src/app/components/dialogs/room-create/room-create.component.html +++ b/src/app/components/dialogs/room-create/room-create.component.html @@ -1,4 +1,4 @@ -<form (ngSubmit)="addRoom(longRoomName.value, shortRoomName.value, description.value)"> +<form (ngSubmit)="addRoom(longRoomName.value, description.value)"> <div fxLayout="column" fxLayoutAlign="center" fxLayoutGap="10px"> <mat-form-field> <input (keypress)="resetEmptyInputs()" matInput #longRoomName class="input-block" type="text" placeholder="Name" @@ -11,17 +11,6 @@ <mat-icon>close</mat-icon> </button> </mat-form-field> - <mat-form-field> - <input (keypress)="resetEmptyInputs()" matInput #shortRoomName class="input-block" type="text" - placeholder="Short name" maxlength="8" - [(ngModel)]="shortName" name="ShortName"/> - <mat-hint align="start" *ngIf="!emptyInputs"><strong>Max. letters / signs:</strong></mat-hint> - <mat-hint align="end" *ngIf="!emptyInputs">{{shortRoomName.value.length}} / 8</mat-hint> - <mat-hint align="start" *ngIf="emptyInputs"><strong>Input is required</strong></mat-hint> - <button mat-button *ngIf="shortName" matSuffix mat-icon-button aria-label="Clear" (click)="shortName=''"> - <mat-icon>close</mat-icon> - </button> - </mat-form-field> <mat-form-field> <textarea (keypress)="resetEmptyInputs()" matInput #description type="text" placeholder="Description" maxlength="255" diff --git a/src/app/components/dialogs/room-create/room-create.component.ts b/src/app/components/dialogs/room-create/room-create.component.ts index 654cefc742e99aa9b8d61e054bb84283fdd6ec00..3842e65cb0ccd82a4f454c055c71a9973c57c3b0 100644 --- a/src/app/components/dialogs/room-create/room-create.component.ts +++ b/src/app/components/dialogs/room-create/room-create.component.ts @@ -35,16 +35,15 @@ export class RoomCreateComponent implements OnInit { this.emptyInputs = false; } - addRoom(longRoomName: string, shortRoomName: string, description: string) { + addRoom(longRoomName: string, description: string) { longRoomName = longRoomName.trim(); - shortRoomName = shortRoomName.trim(); - if (!longRoomName || !shortRoomName) { + if (!longRoomName) { this.emptyInputs = true; return; } this.roomService.addRoom({ name: longRoomName, - abbreviation: shortRoomName, + abbreviation: '00000000', description: description } as Room).subscribe(room => { this.room = room; diff --git a/src/app/components/dialogs/room-edit/room-edit.component.html b/src/app/components/dialogs/room-edit/room-edit.component.html index ec6dd5b7802775a7bc62b9958df6c6888bb5a74c..b72abbe5b44e3ad93dd3738be2af150168fb67c9 100644 --- a/src/app/components/dialogs/room-edit/room-edit.component.html +++ b/src/app/components/dialogs/room-edit/room-edit.component.html @@ -1,20 +1,16 @@ <div *ngIf="editRoom"> <mat-form-field class="input-block"> - <input [(ngModel)]="editRoom.name" #roomName matInput/> - </mat-form-field> - <mat-form-field class="input-block"> - <input [(ngModel)]="editRoom.abbreviation" #roomAbbreviation matInput/> + <input [(ngModel)]="editRoom.name" #roomName matInput placeholder="Room name"/> </mat-form-field> <mat-form-field class="input-block"> <textarea [(ngModel)]="editRoom.description" #roomDescription matInput matTextareaAutosize - matAutosizeMinRows="2" - matAutosizeMaxRows="5"></textarea> + matAutosizeMinRows="2" matAutosizeMaxRows="5" placeholder="Description"></textarea> </mat-form-field> <div fxLayout="row" fxLayoutAlign="center" fxLayoutGap="10px"> <button (click)="dialogRef.close('abort')" mat-button color="primary"> Leave </button> - <button (click)="dialogRef.close('edit')" mat-button color="primary"> + <button (click)="dialogRef.close('edit')" mat-raised-button color="primary"> Update </button> </div> diff --git a/src/app/components/pages/room-creator-page/room-creator-page.component.ts b/src/app/components/pages/room-creator-page/room-creator-page.component.ts index de14a416afadad3deed2d8b78176f4525841b478..d1ba3beb5669d57dd76fa87c489826817cd4cc04 100644 --- a/src/app/components/pages/room-creator-page/room-creator-page.component.ts +++ b/src/app/components/pages/room-creator-page/room-creator-page.component.ts @@ -22,8 +22,7 @@ export class RoomCreatorPageComponent extends RoomPageComponent implements OnIni protected notification: NotificationService, protected route: ActivatedRoute, protected location: Location, - public dialog: MatDialog - ) { + public dialog: MatDialog) { super(roomService, route, location); } @@ -39,18 +38,17 @@ export class RoomCreatorPageComponent extends RoomPageComponent implements OnIni updateRoom(): void { if ((this.updRoom.name === this.room.name) && - (this.updRoom.shortId === this.room.shortId) && (this.updRoom.description === this.room.description) ) { this.notification.show('There were no changes'); return; } else { - this.notification.show('Changes are made'); this.room.name = this.updRoom.name; - this.room.shortId = this.updRoom.shortId; this.room.description = this.updRoom.description; this.roomService.updateRoom(this.room) - .subscribe(); + .subscribe(() => { + this.notification.show('Changes are made'); + }); } }