From 24becc89cbc86168f02ac4ca6b7e81cfd92de3a2 Mon Sep 17 00:00:00 2001
From: Lukas Kimpel <lukas.kimpel@mni.thm.de>
Date: Wed, 21 Mar 2018 00:33:58 +0100
Subject: [PATCH] Remove short id from room edit/room create Fix some minor
 style issues related to room create/room edit

---
 .../dialogs/room-create/room-create.component.html  | 13 +------------
 .../dialogs/room-create/room-create.component.ts    |  7 +++----
 .../dialogs/room-edit/room-edit.component.html      | 10 +++-------
 .../room-creator-page.component.ts                  | 10 ++++------
 4 files changed, 11 insertions(+), 29 deletions(-)

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 5ee9f7fbc..8ee98a5bb 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 654cefc74..3842e65cb 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 ec6dd5b78..b72abbe5b 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 de14a416a..d1ba3beb5 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');
+        });
     }
   }
 
-- 
GitLab