Commit a15930b1 authored by saliou673's avatar saliou673
Browse files

FRONT: add post meta info

parent cafada99
......@@ -23,6 +23,7 @@ import {CookieService} from 'ngx-cookie-service';
import {SignoutComponent} from './signout/signout.component';
import {httpInterceptorProviders} from "./services";
import { CreatePostComponent } from './create-post/create-post.component';
import { CommentCountPipe } from './pipe/commentCount'
@NgModule({
declarations: [
......@@ -39,7 +40,8 @@ import { CreatePostComponent } from './create-post/create-post.component';
QuestionComponent,
PostDetailsComponent,
SignoutComponent,
CreatePostComponent
CreatePostComponent,
CommentCountPipe
],
imports: [
HttpClientModule,
......
......@@ -8,4 +8,6 @@ export class Post {
author: User = new User();
date: string = '';
comments: Comment[] = [];
upVote:number = 0;
downVote:number = 0;
}
\ No newline at end of file
import {Pipe, PipeTransform} from '@angular/core';
import { Comment } from '../model/comment';
@Pipe({name: 'commentCount'})
export class CommentCountPipe implements PipeTransform {
transform(value: Comment[]) {
let count = 0;
value.forEach(comment => {
count += comment.reply.length + 1
});
return count;
}
}
\ No newline at end of file
......@@ -2,11 +2,13 @@
<div class="row">
<div class="col-md-1">
<div class="left-user12923 left-user12923-repeat">
<a href="#"><img src="assets/image/images.png" alt="image"> </a> <a href="#"><i class="fa fa-check"
aria-hidden="true"></i></a>
<a href="#">
<img src="assets/image/emptyProfil.jpg" alt="Photo de profil">
<b>{{post.author.userName }}</b>
</a>
</div>
</div>
<div class="col-md-9">
<div class="col-md-11">
<div class="right-description893">
<div id="que-hedder2983">
<h3><a [routerLink]="['/posts', post.id]">{{ post.subject }}</a></h3>
......@@ -15,23 +17,14 @@
<p class="mb">{{ post.content }} </p>
</div>
<hr>
<div class="ques-icon-info3293"> <a href="#"><i class="fa fa-star" aria-hidden="true"> 5 </i> </a> <a
href="#"><i class="fa fa-folder" aria-hidden="true"> wordpress</i></a> <a href="#"><i
class="fa fa-clock-o" aria-hidden="true"> 4 min ago</i></a> <a href="#"><i
class="fa fa-question-circle-o" aria-hidden="true"> Question</i></a> <a href="#"><i
class="fa fa-bug" aria-hidden="true"> Report</i></a> </div>
</div>
</div>
<div class="col-md-2">
<div class="ques-type302">
<a href="#">
<button type="button" class="q-type238"><i class="fa fa-comment" aria-hidden="true"> 333335
answer</i></button>
</a>
<a href="#">
<button type="button" class="q-type23 button-ques2973"> <i class="fa fa-user-circle-o"
aria-hidden="true"> 70 view</i> </button>
</a>
<div class="ques-icon-info3293">
<a href="#"><i class="fa fa-thumbs-up" aria-hidden="true">{{ post.upVote }}</i> </a>
<a href="#"><i class="fa fa-thumbs-down" aria-hidden="true">{{ post.downVote }}</i> </a>
<a href="#"><i class="fa fa-folder" aria-hidden="true"> wordpress</i></a>
<a href="#"><i class="fa fa-clock-o" aria-hidden="true"> {{post.date | date: 'short'}}</i></a>
<a href="#"><i class="fa fa-comment" aria-hidden="true"> {{post.comments | commentCount}}</i></a>
<a href="#"><i class="fa fa-user" aria-hidden="true">{{post.author.userName }}</i></a>
</div>
</div>
</div>
</div>
......
......@@ -2334,4 +2334,4 @@ h5:hover {
.mb {
margin-bottom: 20px;
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment