From 00f79ea63fd81b96db020a8f4e6f86870cd47bea Mon Sep 17 00:00:00 2001
From: Hagen <hagen.dressler@mni.thm.de>
Date: Wed, 7 Mar 2018 14:44:43 +0100
Subject: [PATCH] Add simple logic components (back, send, routing)

---
 .../create-comment.component.html             |  7 +++---
 .../create-comment.component.ts               | 24 ++++++++++++++++---
 2 files changed, 25 insertions(+), 6 deletions(-)

diff --git a/src/app/create-comment/create-comment.component.html b/src/app/create-comment/create-comment.component.html
index 109cf9c0c..74564dd71 100644
--- a/src/app/create-comment/create-comment.component.html
+++ b/src/app/create-comment/create-comment.component.html
@@ -1,11 +1,12 @@
 <form>
   <mat-form-field class="input-block">
-    <input matInput type="text" maxlength="24" placeholder="Choose a title">
+    <input matInput #subject type="text" maxlength="24" placeholder="Choose a title">
   </mat-form-field>
   <mat-form-field class="input-block">
+    <input matInput #text >
     <textarea matInput placeholder="Add your comment"></textarea>
   </mat-form-field>
 
-  <button mat-raised-button color="primary">Back</button>
-  <button mat-raised-button color="primary">Send</button>
+  <button mat-raised-button color="primary" (click)="goBack()">Back</button>
+  <button mat-raised-button color="primary" (click)="send(subject.value, text.value)">Send</button>
 </form>
diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts
index 1d7860507..700643e5e 100644
--- a/src/app/create-comment/create-comment.component.ts
+++ b/src/app/create-comment/create-comment.component.ts
@@ -1,4 +1,8 @@
-import { Component, OnInit } from '@angular/core';
+import { Component, OnInit, Input } from '@angular/core';
+import { ActivatedRoute } from '@angular/router';
+import { Location } from '@angular/common';
+
+import { Room } from '../room';
 
 @Component({
   selector: 'app-create-comment',
@@ -6,10 +10,24 @@ import { Component, OnInit } from '@angular/core';
   styleUrls: ['./create-comment.component.scss']
 })
 export class CreateCommentComponent implements OnInit {
+  @Input() room: Room;
+
+  constructor(
+    private route: ActivatedRoute,
+    private location: Location,
+  ) { }
 
-  constructor() { }
+  ngOnInit(): void {
+    this.getRoom();
+  }
 
-  ngOnInit() {
+  getRoom(): void {
+    const id = +this.route.snapshot.paramMap.get('id');
   }
 
+  send(subject: string, text: string): void {}
+
+  goBack(): void {
+    this.location.back();
+  }
 }
-- 
GitLab