From 7c96695c123db0df235caec57b983b64a7015d63 Mon Sep 17 00:00:00 2001
From: Sebastian Wittek <sebastian.wittek@mni.thm.de>
Date: Thu, 11 Apr 2019 11:25:54 +0200
Subject: [PATCH] add timestamp to html

---
 .../shared/comment-list/comment-list.component.ts          | 1 -
 src/app/components/shared/comment/comment.component.html   | 7 +++++++
 src/app/components/shared/comment/comment.component.scss   | 6 ++++++
 src/app/models/comment.ts                                  | 4 ++--
 src/app/services/http/comment.service.ts                   | 2 +-
 5 files changed, 16 insertions(+), 4 deletions(-)

diff --git a/src/app/components/shared/comment-list/comment-list.component.ts b/src/app/components/shared/comment-list/comment-list.component.ts
index 8e097e465..a734f405e 100644
--- a/src/app/components/shared/comment-list/comment-list.component.ts
+++ b/src/app/components/shared/comment-list/comment-list.component.ts
@@ -69,7 +69,6 @@ export class CommentListComponent implements OnInit {
         c.roomId = this.roomId;
         c.body = payload.body;
         c.id = payload.id;
-        c.creationTimestamp = payload.timestamp;
         this.comments = this.comments.concat(c);
         break;
       case 'CommentPatched':
diff --git a/src/app/components/shared/comment/comment.component.html b/src/app/components/shared/comment/comment.component.html
index d1363c036..1f831baca 100644
--- a/src/app/components/shared/comment/comment.component.html
+++ b/src/app/components/shared/comment/comment.component.html
@@ -25,5 +25,12 @@
         </button>
       </div>
     </div>
+    <div id="footer">
+      <div id="date">
+        {{comment.timestamp}}
+      </div>
+      <div id="counter">
+      </div>
+    </div>
   </div>
 </mat-card>
diff --git a/src/app/components/shared/comment/comment.component.scss b/src/app/components/shared/comment/comment.component.scss
index 3174c0b72..f28d12f68 100644
--- a/src/app/components/shared/comment/comment.component.scss
+++ b/src/app/components/shared/comment/comment.component.scss
@@ -76,3 +76,9 @@ h2 {
   overflow: hidden;
   text-overflow: ellipsis;
 }
+
+.date {
+  position: fixed;
+  bottom: 0;
+  left: 0;
+}
diff --git a/src/app/models/comment.ts b/src/app/models/comment.ts
index 2fb2ad760..df7165a4b 100644
--- a/src/app/models/comment.ts
+++ b/src/app/models/comment.ts
@@ -7,7 +7,7 @@ export class Comment {
   read: boolean;
   correct: boolean;
   favorite: boolean;
-  creationTimestamp: Date;
+  timestamp: Date;
   score: number;
   createdFromLecturer: boolean;
 
@@ -28,7 +28,7 @@ export class Comment {
     this.read = read;
     this.correct = correct;
     this.favorite = favorite;
-    this.creationTimestamp = creationTimestamp;
+    this.timestamp = creationTimestamp;
     this.score = score;
     this.createdFromLecturer = createdFromLecturer;
   }
diff --git a/src/app/services/http/comment.service.ts b/src/app/services/http/comment.service.ts
index d8673aa27..c3179ad69 100644
--- a/src/app/services/http/comment.service.ts
+++ b/src/app/services/http/comment.service.ts
@@ -33,7 +33,7 @@ export class CommentService extends BaseHttpService {
     const connectionUrl = this.apiUrl.base + this.apiUrl.comment + '/';
     return this.http.post<Comment>(connectionUrl,
       { roomId: comment.roomId, body: comment.body,
-        read: comment.read, creationTimestamp: comment.creationTimestamp
+        read: comment.read, creationTimestamp: comment.timestamp
       }, httpOptions).pipe(
         tap(_ => ''),
         catchError(this.handleError<Comment>('addComment'))
-- 
GitLab