HTMLContent test

master
lampe_n1 5 years ago
parent 1aa5832a25
commit 2dab19127e

@ -15,26 +15,5 @@
<div *ngIf = "viewMostLiked">
<feed-postlist (voteEvent)="refresh($event)" [childPostList]="parentSelectedPostList"></feed-postlist>
</div>
<!--
<div class="feeditem">
<div class="itemhead">
<div class="usertag">
<span class="title">post.username</span>
<span class="handle"><a href="#">post.handle</a></span>
</div>
<span class="date">post.date</span>
</div>
<div class="itembody">
<div class='text'>
<p>post.message</p>
</div>
<div class="vote">
<button id="down" type='submit'><span><i class="fa fa-thumbs-o-down fa-2x" aria-hidden="true"></i></span></button>
<button id="up" type='submit'><span><i class="fa fa-thumbs-o-up fa-2x" aria-hidden="true"></i></span></button>
<span id="votecounter">post.votes</span>
</div>
</div>
</div>
-->
</div>
</div>

@ -8,6 +8,7 @@
</div>
<div class="itembody">
<div class='text'>
<p *ngIf="post.htmlContent.length() > 0">{{post.htmlContent}}</p>
<p>{{post.content}}</p>
</div>
<div class="vote">

@ -3,14 +3,16 @@ import { Author } from "./author"
export class Post {
id: number
content: string
htmlContent: string
date: string
upvotes: number
downvotes: number
author: Author
constructor(pId: number, pContent: string, pUpvotes: number, pDownvotes: number, pDate: string, pAuthor: Author) {
constructor(pId: number, pContent: string, pHtmlContent: string, pUpvotes: number, pDownvotes: number, pDate: string, pAuthor: Author) {
this.id = pId
this.content = pContent
this.htmlContent = pHtmlContent
this.upvotes = pUpvotes
this.downvotes = pDownvotes
this.date = pDate

@ -99,7 +99,7 @@ export class FeedService {
getBodyForGetAllChats() {
const body = {query: `query {
getPosts (first: 1000, offset: 0) {id, content, upvotes, downvotes, author{name, handle, id}, createdAt}
getPosts (first: 1000, offset: 0) {id, content, htmlContent, upvotes, downvotes, author{name, handle, id}, createdAt}
}`
}
@ -111,12 +111,13 @@ export class FeedService {
for(let post of pResponse.data.getPosts) {
let id: number = post.id
let content: string = post.content
let htmlContent: string = post.htmlContent
let upvotes: number = post.upvotes
let downvotes: number = post.downvotes
let author = new Author(post.author.id, post.author.name, post.author.handle)
let date = post.createdAt
posts.push(new Post(id, content, upvotes, downvotes, date, author))
posts.push(new Post(id, content, htmlContent, upvotes, downvotes, date, author))
}
return posts
}

Loading…
Cancel
Save