mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
add comment in participation
This commit is contained in:
parent
05fbbdf466
commit
29effc4f09
@ -142,7 +142,10 @@ export class ApiService {
|
|||||||
|
|
||||||
public async createComment(slug: string, comment: string): Promise<string> {
|
public async createComment(slug: string, comment: string): Promise<string> {
|
||||||
try {
|
try {
|
||||||
return await this.axiosInstance.post(`${this.pollsEndpoint}/${slug}${this.commentsEndpoint}`, comment);
|
return await this.axiosInstance.post(
|
||||||
|
`${this.baseHref}${this.commentsEndpoint}/${slug}${this.commentsEndpoint}`,
|
||||||
|
comment
|
||||||
|
);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
ApiService.handleError(error);
|
ApiService.handleError(error);
|
||||||
}
|
}
|
||||||
|
@ -56,9 +56,9 @@
|
|||||||
<div class="span resume">
|
<div class="span resume">
|
||||||
<div class="well">
|
<div class="well">
|
||||||
Du
|
Du
|
||||||
{{ form.value.startDateInterval | date: 'EEEE d':'Europe/Paris':'fr_FR' }}
|
{{ form.value.startDateInterval | date: 'EEEE d':'Europe/Paris' }}
|
||||||
au
|
au
|
||||||
{{ form.value.endDateInterval | date: 'EEEE d':'Europe/Paris':'fr_FR' }}
|
{{ form.value.endDateInterval | date: 'EEEE d':'Europe/Paris' }}
|
||||||
, soit {{ intervalDays }} jours.
|
, soit {{ intervalDays }} jours.
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -117,7 +117,7 @@
|
|||||||
class="button is-primary cancel-button-reject pull-right"
|
class="button is-primary cancel-button-reject pull-right"
|
||||||
(click)="focusOnCancelButton()"
|
(click)="focusOnCancelButton()"
|
||||||
>
|
>
|
||||||
Fermer <i class="fa fa-times"></i>
|
{{ 'SENTENCES.Close' | translate }} <i class="fa fa-times"></i>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<h1 class="title">
|
<h1 class="title">
|
||||||
|
@ -13,7 +13,7 @@ import { EditComponent } from './edit/edit.component';
|
|||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{
|
{
|
||||||
path: '',
|
path: '',
|
||||||
component: ConsultationLandingComponent,
|
component: ConsultationComponent,
|
||||||
},
|
},
|
||||||
{ path: 'simple', component: ConsultationComponent },
|
{ path: 'simple', component: ConsultationComponent },
|
||||||
{ path: 'secure/:pass_hash', component: ConsultationComponent },
|
{ path: 'secure/:pass_hash', component: ConsultationComponent },
|
||||||
|
@ -80,7 +80,7 @@
|
|||||||
{{ 'participation.fav_choice' | translate }}
|
{{ 'participation.fav_choice' | translate }}
|
||||||
</h2>
|
</h2>
|
||||||
<div class="rounded-block">
|
<div class="rounded-block">
|
||||||
<div class="section no-votes">
|
<div class="no-votes">
|
||||||
<div class="message is-info" *ngIf="poll.stacks.length == 0">
|
<div class="message is-info" *ngIf="poll.stacks.length == 0">
|
||||||
<div class="message-body">
|
<div class="message-body">
|
||||||
{{ 'participation.no_votes_yet' | translate }}
|
{{ 'participation.no_votes_yet' | translate }}
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
{{ choice.name }}
|
{{ choice.name }}
|
||||||
</span>
|
</span>
|
||||||
<span class="label" *ngIf="poll.kind == 'date' && choice.name.indexOf('>>>') === -1">
|
<span class="label" *ngIf="poll.kind == 'date' && choice.name.indexOf('>>>') === -1">
|
||||||
{{ make_date(choice.name) | date: 'fullDate':'Europe/Paris':'fr_FR' }}
|
{{ make_date(choice.name) | date: 'fullDate':'Europe/Paris' }}
|
||||||
</span>
|
</span>
|
||||||
<span class="label" *ngIf="poll.kind == 'date' && choice.name.indexOf('>>>') !== -1">
|
<span class="label" *ngIf="poll.kind == 'date' && choice.name.indexOf('>>>') !== -1">
|
||||||
{{ make_display_range_time(choice.name) }}
|
{{ make_display_range_time(choice.name) }}
|
||||||
@ -101,7 +101,7 @@
|
|||||||
{{ stack.pseudo }}
|
{{ stack.pseudo }}
|
||||||
</div>
|
</div>
|
||||||
<div class="date">
|
<div class="date">
|
||||||
<sub> le {{ make_date(stack.created_at) | date: 'short':'Europe/Paris':'fr_FR' }} </sub>
|
<sub> le {{ make_date(stack.created_at) | date: 'short':'Europe/Paris' }} </sub>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<ng-container *ngFor="let vote of stack.votes">
|
<ng-container *ngFor="let vote of stack.votes">
|
||||||
|
@ -30,3 +30,35 @@
|
|||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
margin-bottom: 1.25rem;
|
margin-bottom: 1.25rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.choice-bars-display {
|
||||||
|
.is-narrow {
|
||||||
|
width: 5em;
|
||||||
|
text-align: right;
|
||||||
|
padding-right: 1em;
|
||||||
|
}
|
||||||
|
.bar {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.bar-div {
|
||||||
|
padding: 0.25rem 0.025rem;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 0.25rem;
|
||||||
|
}
|
||||||
|
div {
|
||||||
|
&.has-background-yes {
|
||||||
|
border: green;
|
||||||
|
background: yellowgreen;
|
||||||
|
@extend .bar-div;
|
||||||
|
}
|
||||||
|
&.has-background-maybe {
|
||||||
|
border: orange;
|
||||||
|
background: yellow;
|
||||||
|
@extend .bar-div;
|
||||||
|
}
|
||||||
|
&.has-background-no {
|
||||||
|
border: red;
|
||||||
|
background: pink;
|
||||||
|
@extend .bar-div;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -8,24 +8,26 @@
|
|||||||
{{ 'participation.comments_new' | translate }}
|
{{ 'participation.comments_new' | translate }}
|
||||||
</h2>
|
</h2>
|
||||||
|
|
||||||
<article class="message" *ngFor="let comment of poll.comments">
|
<article class="message rounded-block" *ngFor="let comment of poll.comments">
|
||||||
<div class="message-header">
|
<div class="header">
|
||||||
<p>
|
<p>
|
||||||
<em class="cname"> {{ comment.pseudo }} </em>,
|
<em class="cname" *ngIf="comment.pseudo"> {{ comment.pseudo }} </em>
|
||||||
|
<em class="cname" *ngIf="!comment.pseudo"> (somebody) </em>
|
||||||
|
,
|
||||||
|
|
||||||
<span class="date date-days-ago">
|
<span class="date date-days-ago">
|
||||||
{{
|
{{
|
||||||
'participation.dipslay_comments_delay'
|
'date_delays.dipslay_comments_delay'
|
||||||
| translate
|
| translate
|
||||||
: {
|
: {
|
||||||
counter_delay: calculateDaysAgoOfComment(comment.created_at),
|
counter_delay: calculateDaysAgoOfComment(comment.created_at),
|
||||||
time_unit: 'participation.days' | translate
|
time_unit: 'date_delays.days' | translate
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
{{ calculateDaysAgoOfComment(comment.created_at) }} ,
|
{{ calculateDaysAgoOfComment(comment.created_at) }} ,
|
||||||
</span>
|
</span>
|
||||||
<span class="date is-small">
|
<span class="date is-small">
|
||||||
{{ comment.created_at | date: 'short':'Europe/Paris':'fr_FR' }}
|
{{ comment.created_at | date: 'short':'Europe/Paris' }}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@ -38,7 +40,7 @@
|
|||||||
</section>
|
</section>
|
||||||
<section class="add-comment" *ngIf="!poll.is_archived && vote_stack.owner">
|
<section class="add-comment" *ngIf="!poll.is_archived && vote_stack.owner">
|
||||||
<article class="message">
|
<article class="message">
|
||||||
<div class="message-header">
|
<div class="header">
|
||||||
<div class="field">
|
<div class="field">
|
||||||
<!-- <span class="control has-icons-left has-icons-right">-->
|
<!-- <span class="control has-icons-left has-icons-right">-->
|
||||||
<!-- <input-->
|
<!-- <input-->
|
||||||
|
@ -3,6 +3,9 @@ import { PollService } from '../../../core/services/poll.service';
|
|||||||
import * as moment from 'moment';
|
import * as moment from 'moment';
|
||||||
import { Stack } from '../../../core/models/stack.model';
|
import { Stack } from '../../../core/models/stack.model';
|
||||||
import { Poll } from '../../../core/models/poll.model';
|
import { Poll } from '../../../core/models/poll.model';
|
||||||
|
import { ApiService } from '../../../core/services/api.service';
|
||||||
|
import { StorageService } from '../../../core/services/storage.service';
|
||||||
|
import { ToastService } from '../../../core/services/toast.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-comments',
|
selector: 'app-comments',
|
||||||
@ -19,7 +22,12 @@ export class CommentsComponent {
|
|||||||
myComment: '',
|
myComment: '',
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(private pollService: PollService) {}
|
constructor(
|
||||||
|
private pollService: PollService,
|
||||||
|
private api: ApiService,
|
||||||
|
private toastService: ToastService,
|
||||||
|
private storageService: StorageService
|
||||||
|
) {}
|
||||||
|
|
||||||
calculateDaysAgoOfComment(dateAsString) {
|
calculateDaysAgoOfComment(dateAsString) {
|
||||||
let numberOfDays = 0;
|
let numberOfDays = 0;
|
||||||
@ -32,6 +40,13 @@ export class CommentsComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
addComment() {
|
addComment() {
|
||||||
alert('TODO');
|
this.api
|
||||||
|
.createComment(this.pollService._poll.getValue().custom_url, this.storageService.vote_stack.comment)
|
||||||
|
.then((resp) => {
|
||||||
|
this.toastService.display('commentaire ajouté');
|
||||||
|
})
|
||||||
|
.catch((error) => {
|
||||||
|
this.toastService.display('Erreur', error.message);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -783,15 +783,15 @@
|
|||||||
"FR": "Fr",
|
"FR": "Fr",
|
||||||
"BR": "Br",
|
"BR": "Br",
|
||||||
"CA": "Ca",
|
"CA": "Ca",
|
||||||
"EL": "el",
|
"EL": "El",
|
||||||
"ES": "Es",
|
"ES": "Es",
|
||||||
"EN": "En",
|
"EN": "En",
|
||||||
"GL": "gl",
|
"GL": "gl",
|
||||||
"HU": "hu",
|
"HU": "hu",
|
||||||
"IT": "It",
|
"IT": "It",
|
||||||
"NL": "Nl",
|
"NL": "Nl",
|
||||||
"OC": "oc",
|
"OC": "Oc",
|
||||||
"SV": "sv"
|
"SV": "Sv"
|
||||||
},
|
},
|
||||||
"calendar_widget": {
|
"calendar_widget": {
|
||||||
"startsWith": "Commence par",
|
"startsWith": "Commence par",
|
||||||
|
@ -33,7 +33,7 @@ export const endpoints = {
|
|||||||
name: '/choices',
|
name: '/choices',
|
||||||
},
|
},
|
||||||
comments: {
|
comments: {
|
||||||
name: '/comments',
|
name: '/comment',
|
||||||
},
|
},
|
||||||
slugs: {
|
slugs: {
|
||||||
name: '/slugs',
|
name: '/slugs',
|
||||||
|
@ -317,6 +317,7 @@ mat-checkbox {
|
|||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
.column {
|
.column {
|
||||||
padding-left: 0;
|
padding-left: 0;
|
||||||
|
padding-right: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user