diff --git a/src/app/core/services/api.service.ts b/src/app/core/services/api.service.ts index c8bf3704..d488522b 100644 --- a/src/app/core/services/api.service.ts +++ b/src/app/core/services/api.service.ts @@ -142,7 +142,10 @@ export class ApiService { public async createComment(slug: string, comment: string): Promise { 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) { ApiService.handleError(error); } diff --git a/src/app/features/administration/form/date/interval/interval.component.html b/src/app/features/administration/form/date/interval/interval.component.html index e91273e9..0aff4395 100644 --- a/src/app/features/administration/form/date/interval/interval.component.html +++ b/src/app/features/administration/form/date/interval/interval.component.html @@ -56,9 +56,9 @@
Du - {{ form.value.startDateInterval | date: 'EEEE d':'Europe/Paris':'fr_FR' }} + {{ form.value.startDateInterval | date: 'EEEE d':'Europe/Paris' }} au - {{ form.value.endDateInterval | date: 'EEEE d':'Europe/Paris':'fr_FR' }} + {{ form.value.endDateInterval | date: 'EEEE d':'Europe/Paris' }} , soit {{ intervalDays }} jours.
diff --git a/src/app/features/administration/stepper/stepper.component.html b/src/app/features/administration/stepper/stepper.component.html index f21a515a..34ef5f8a 100644 --- a/src/app/features/administration/stepper/stepper.component.html +++ b/src/app/features/administration/stepper/stepper.component.html @@ -117,7 +117,7 @@ class="button is-primary cancel-button-reject pull-right" (click)="focusOnCancelButton()" > - Fermer + {{ 'SENTENCES.Close' | translate }}

diff --git a/src/app/features/consultation/consultation-routing.module.ts b/src/app/features/consultation/consultation-routing.module.ts index 4a980cf7..5ef00dbf 100644 --- a/src/app/features/consultation/consultation-routing.module.ts +++ b/src/app/features/consultation/consultation-routing.module.ts @@ -13,7 +13,7 @@ import { EditComponent } from './edit/edit.component'; const routes: Routes = [ { path: '', - component: ConsultationLandingComponent, + component: ConsultationComponent, }, { path: 'simple', component: ConsultationComponent }, { path: 'secure/:pass_hash', component: ConsultationComponent }, diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index 879451b0..895a46c1 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -80,7 +80,7 @@ {{ 'participation.fav_choice' | translate }}

-
+
{{ 'participation.no_votes_yet' | translate }} diff --git a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html index 9b507401..35c4890c 100644 --- a/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html +++ b/src/app/features/consultation/poll-results-detailed/poll-results-detailed.component.html @@ -10,7 +10,7 @@ {{ choice.name }} - {{ make_date(choice.name) | date: 'fullDate':'Europe/Paris':'fr_FR' }} + {{ make_date(choice.name) | date: 'fullDate':'Europe/Paris' }} {{ make_display_range_time(choice.name) }} @@ -101,7 +101,7 @@ {{ stack.pseudo }}
- le {{ make_date(stack.created_at) | date: 'short':'Europe/Paris':'fr_FR' }} + le {{ make_date(stack.created_at) | date: 'short':'Europe/Paris' }}
diff --git a/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss index 9aa98043..7d4a56b3 100644 --- a/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss +++ b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss @@ -30,3 +30,35 @@ font-weight: bold; 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; + } +} diff --git a/src/app/shared/components/comments/comments.component.html b/src/app/shared/components/comments/comments.component.html index 6db50d67..92d58111 100644 --- a/src/app/shared/components/comments/comments.component.html +++ b/src/app/shared/components/comments/comments.component.html @@ -8,24 +8,26 @@ {{ 'participation.comments_new' | translate }} -
-
+
+

- {{ comment.pseudo }} , + {{ comment.pseudo }} + (somebody) + , {{ - 'participation.dipslay_comments_delay' + 'date_delays.dipslay_comments_delay' | translate : { counter_delay: calculateDaysAgoOfComment(comment.created_at), - time_unit: 'participation.days' | translate + time_unit: 'date_delays.days' | translate } }} {{ calculateDaysAgoOfComment(comment.created_at) }} , - {{ comment.created_at | date: 'short':'Europe/Paris':'fr_FR' }} + {{ comment.created_at | date: 'short':'Europe/Paris' }}

@@ -38,7 +40,7 @@
-
+
diff --git a/src/app/shared/components/comments/comments.component.ts b/src/app/shared/components/comments/comments.component.ts index 93eec15e..19cd0016 100644 --- a/src/app/shared/components/comments/comments.component.ts +++ b/src/app/shared/components/comments/comments.component.ts @@ -3,6 +3,9 @@ import { PollService } from '../../../core/services/poll.service'; import * as moment from 'moment'; import { Stack } from '../../../core/models/stack.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({ selector: 'app-comments', @@ -19,7 +22,12 @@ export class CommentsComponent { myComment: '', }; - constructor(private pollService: PollService) {} + constructor( + private pollService: PollService, + private api: ApiService, + private toastService: ToastService, + private storageService: StorageService + ) {} calculateDaysAgoOfComment(dateAsString) { let numberOfDays = 0; @@ -32,6 +40,13 @@ export class CommentsComponent { } 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); + }); } } diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index 7b7b4b88..dd61a2fa 100755 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -783,15 +783,15 @@ "FR": "Fr", "BR": "Br", "CA": "Ca", - "EL": "el", + "EL": "El", "ES": "Es", "EN": "En", "GL": "gl", "HU": "hu", "IT": "It", "NL": "Nl", - "OC": "oc", - "SV": "sv" + "OC": "Oc", + "SV": "Sv" }, "calendar_widget": { "startsWith": "Commence par", diff --git a/src/environments/endpoints.ts b/src/environments/endpoints.ts index 775786bf..c25795db 100644 --- a/src/environments/endpoints.ts +++ b/src/environments/endpoints.ts @@ -33,7 +33,7 @@ export const endpoints = { name: '/choices', }, comments: { - name: '/comments', + name: '/comment', }, slugs: { name: '/slugs', diff --git a/src/styles/partials/_forms.scss b/src/styles/partials/_forms.scss index f19abd9a..68ec7a9a 100644 --- a/src/styles/partials/_forms.scss +++ b/src/styles/partials/_forms.scss @@ -317,6 +317,7 @@ mat-checkbox { margin-top: 0; .column { padding-left: 0; + padding-right: 0; } } }