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 = [
{
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" +
" Skitty Rock Luxio Surskit. Glacier Badge",
},
{
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",
},
];

View File

@ -104,6 +104,15 @@ export const mockPoll1 = {
"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
};

View File

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

View File

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