mock for poll 1, fix new comment

This commit is contained in:
Baptiste Lemoine 2020-01-22 16:58:38 +01:00
parent 02995c8b3d
commit 346bd9dc4f
4 changed files with 30 additions and 6 deletions

View File

@ -1,13 +1,21 @@
export const mockComments = [ export const mockComments = [
{ {
pseudo: "Bulbizarre", pseudo: "Bulbizarre",
date: "23 décembre 2019", "date": {
"date": "2020-01-22 16:00:22.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" + text: "Pokem ipsum dolor sit amet Electric Cottonee Scratch Leech Life Ice Berry Ducklett. Leaf Green Durant Zoroark\n" +
" Skitty Rock Luxio Surskit. Glacier Badge", " Skitty Rock Luxio Surskit. Glacier Badge",
}, },
{ {
pseudo: "Marylin", pseudo: "Marylin",
date: "5 Janvier 2020", "date": {
"date": "2020-01-22 16:00:22.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
},
text: "j'ai vu de la lumière o_o", text: "j'ai vu de la lumière o_o",
}, },
]; ];

View File

@ -104,6 +104,15 @@ export const mockPoll1 = {
"url": null "url": null
} }
], ],
"comments": [], "comments": [{
"id": 4,
"text": "wouah trop bien framadate HOUHOUUUU!",
"pseudo": "tk_TEST",
"date": {
"date": "2020-01-22 16:00:22.000000",
"timezone_type": 3,
"timezone": "Europe/Paris"
}
},],
"comments_count": 0 "comments_count": 0
}; };

View File

@ -1,6 +1,10 @@
<div class="comment" > <div class="comment" >
<span class="cname" >{{comment.pseudo}} </span >, le <span class="cname" >
<span class="date padding-btm-x1" >{{comment.date.date | date:'medium'}}</span > {{comment.pseudo}}
</span >, le
<span class="date padding-btm-x1" >
{{comment.date.date | date:'medium'}}
</span >
<blockquote > <blockquote >
<p class="text" > <p class="text" >
{{comment.text}} {{comment.text}}

View File

@ -363,6 +363,7 @@ export class ConfigService extends PollConfig {
if (!comment && this.myComment) { if (!comment && this.myComment) {
comment = { comment = {
name: this.myName, name: this.myName,
pseudo: this.myName,
email: this.myEmail, email: this.myEmail,
date: new Date(), date: new Date(),
text: this.myComment, text: this.myComment,
@ -380,10 +381,12 @@ export class ConfigService extends PollConfig {
}); });
// empty comment after success // empty comment after success
this.myComment = ''; this.myComment = '';
comment.date = {
date: comment.date
};
this.currentPoll.comments.push(comment); this.currentPoll.comments.push(comment);
}, (e) => { }, (e) => {
this.handleError(e); this.handleError(e);
this.currentPoll.comments.push(comment);
} }
); );
} }