From d8f2a718e470447e776c9aa8b5d01fee1e23d78f Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 7 Feb 2022 13:58:23 +0100 Subject: [PATCH] add AR lang :alien: and complete sections of consultation --- src/app/core/enums/language.enum.ts | 1 + .../consultation/consultation.component.html | 94 ++++++++++++++++++- .../consultation/consultation.component.scss | 9 ++ .../consultation/consultation.component.ts | 3 + .../consultation/consultation.module.ts | 2 + .../consultation/edit/edit.component.html | 27 +++++- .../poll-results-compact.component.html | 3 +- .../poll-results-dinum.component.html | 23 +++++ .../poll-results-dinum.component.scss | 3 + .../poll-results-dinum.component.spec.ts | 24 +++++ .../poll-results-dinum.component.ts | 26 +++++ .../comments/comments.component.html | 55 ++++++----- src/assets/i18n/en.json | 17 ++++ src/assets/i18n/fr.json | 2 + src/styles/partials/_forms.scss | 9 ++ 15 files changed, 272 insertions(+), 26 deletions(-) create mode 100644 src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.html create mode 100644 src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss create mode 100644 src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.spec.ts create mode 100644 src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.ts diff --git a/src/app/core/enums/language.enum.ts b/src/app/core/enums/language.enum.ts index fffb2491..5e319c1d 100644 --- a/src/app/core/enums/language.enum.ts +++ b/src/app/core/enums/language.enum.ts @@ -3,6 +3,7 @@ * Cette enum est utilisé dans le composant de sélection de langue. */ export enum LanguageEnum { + ar = 'ar', br = 'br', ca = 'ca', de = 'de', diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index 236c8e51..a4e69fb1 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -1,6 +1,52 @@ +
+
+
+
+ + + +

+ + {{ 'creation.title' | translate }} + + + + + {{ pollService.form.value.title }} + + + {{ 'nav.no_title' | translate }} + + +

+
+
+ + +
+
+
+
+
-
+

@@ -18,7 +64,51 @@

{{ poll.description }}

-

+ +
+
+

+ {{ 'participation.fav_choice' | translate }} +

+
+
+
+
+ {{ 'participation.no_votes_yet' | translate }} +
+ {{ 'participation.fav_description_not_exist' | translate }} +
+
+
+
+ {{ 'participation.fav_description_one' | translate: { maxYesCount: maxYesCount } }} + {{ 'participation.fav_description_several' | translate }} +
+
+
+ +
+

+ {{ 'participation.poll' | translate }} +

+
+ +
+
+
+

+ {{ 'participation.comments' | translate }} +

+
+ + + + + +
+
diff --git a/src/app/features/consultation/consultation.component.scss b/src/app/features/consultation/consultation.component.scss index df9b068e..4dcb562c 100644 --- a/src/app/features/consultation/consultation.component.scss +++ b/src/app/features/consultation/consultation.component.scss @@ -4,3 +4,12 @@ left: 1em; z-index: 10; } + +.poll_loaded { + .title { + margin-bottom: 0; + } + .description { + min-height: 2rem; + } +} diff --git a/src/app/features/consultation/consultation.component.ts b/src/app/features/consultation/consultation.component.ts index dba37e08..0d4b2ece 100644 --- a/src/app/features/consultation/consultation.component.ts +++ b/src/app/features/consultation/consultation.component.ts @@ -8,6 +8,7 @@ import { PollUtilitiesService } from '../../core/services/poll.utilities.service import { StorageService } from '../../core/services/storage.service'; import { ApiService } from '../../core/services/api.service'; import { ToastService } from '../../core/services/toast.service'; +import { environment } from 'src/environments/environment'; @Component({ selector: 'app-consultation', @@ -17,12 +18,14 @@ import { ToastService } from '../../core/services/toast.service'; export class ConsultationComponent implements OnInit, OnDestroy { public fetching = true; + public environment = environment; private routeSubscription: Subscription; window: any; private isArchived: boolean; private poll: Poll; private pollSlug: string; private pass_hash: string; + maxYesCount: any = 1; constructor( private router: Router, diff --git a/src/app/features/consultation/consultation.module.ts b/src/app/features/consultation/consultation.module.ts index ad73ace5..a05facd9 100644 --- a/src/app/features/consultation/consultation.module.ts +++ b/src/app/features/consultation/consultation.module.ts @@ -17,6 +17,7 @@ import { SuccessComponent } from './success/success.component'; import { AdministrationModule } from '../administration/administration.module'; import { EditComponent } from './edit/edit.component'; import { ResultsRoundedComponent } from './results-rounded/results-rounded.component'; +import { PollResultsDinumComponent } from './poll-results-dinum/poll-results-dinum.component'; @NgModule({ declarations: [ @@ -30,6 +31,7 @@ import { ResultsRoundedComponent } from './results-rounded/results-rounded.compo SuccessComponent, EditComponent, ResultsRoundedComponent, + PollResultsDinumComponent, ], imports: [ CommonModule, diff --git a/src/app/features/consultation/edit/edit.component.html b/src/app/features/consultation/edit/edit.component.html index 436cb764..49c0e8ce 100644 --- a/src/app/features/consultation/edit/edit.component.html +++ b/src/app/features/consultation/edit/edit.component.html @@ -6,6 +6,31 @@
-
+
+
+

+ {{ choice.name }} +

+ + + + +
+
diff --git a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html index fbe52f18..29d9b370 100644 --- a/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html +++ b/src/app/features/consultation/poll-results-compact/poll-results-compact.component.html @@ -1,4 +1,3 @@ -{{ poll.choices.length }} choix

@@ -9,7 +8,7 @@ > - {{ showAsDate(group.date_string) | date: 'fullDate':'Europe/Paris':'fr' }} + {{ showAsDate(group.date_string) | date: 'fullDate':'Europe/Paris' }}

diff --git a/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.html b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.html new file mode 100644 index 00000000..b62abde7 --- /dev/null +++ b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.html @@ -0,0 +1,23 @@ +
+
+

+ {{ showAsDate(group.date_string) | date: 'fullDate':'Europe/Paris' }} +

+
+

+ {{ choice.name }} +

+
+
+
+ + + +
+
+
+
+
+
+
+
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 new file mode 100644 index 00000000..b4d3785d --- /dev/null +++ b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.scss @@ -0,0 +1,3 @@ +.max_score { + color: green; +} diff --git a/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.spec.ts b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.spec.ts new file mode 100644 index 00000000..76c71c2a --- /dev/null +++ b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { PollResultsDinumComponent } from './poll-results-dinum.component'; + +describe('PollResultsDinumComponent', () => { + let component: PollResultsDinumComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [PollResultsDinumComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(PollResultsDinumComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.ts b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.ts new file mode 100644 index 00000000..5185fac0 --- /dev/null +++ b/src/app/features/consultation/poll-results-dinum/poll-results-dinum.component.ts @@ -0,0 +1,26 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { Poll } from '../../../core/models/poll.model'; +import { Answer } from '../../../core/enums/answer.enum'; +import { ModalService } from '../../../core/services/modal.service'; +import { StorageService } from '../../../core/services/storage.service'; + +@Component({ + selector: 'app-poll-results-dinum', + templateUrl: './poll-results-dinum.component.html', + styleUrls: ['./poll-results-dinum.component.scss'], +}) +export class PollResultsDinumComponent implements OnInit { + @Input() public poll: Poll; + public answerEnum = Answer; + constructor(private modalService: ModalService, private storageService: StorageService) {} + + ngOnInit(): void {} + + toggleAnswer(choice_id: number, value: string) { + this.storageService.toggleAnswer(choice_id, value); + } + + showAsDate(date_string: string) { + return new Date(date_string); + } +} diff --git a/src/app/shared/components/comments/comments.component.html b/src/app/shared/components/comments/comments.component.html index 79ddc26b..6ba589c8 100644 --- a/src/app/shared/components/comments/comments.component.html +++ b/src/app/shared/components/comments/comments.component.html @@ -4,8 +4,8 @@

- - {{ poll.comments.length }} Commentaires + + {{ 'participation.comments_new' | translate }}

@@ -14,9 +14,17 @@ {{ comment.pseudo }} , - il y a - {{ calculateDaysAgoOfComment(comment.created_at) }} jours, le + {{ + 'participation.dipslay_comments_delay' + | translate + : { + counter_delay: calculateDaysAgoOfComment(comment.created_at), + time_unit: 'participation.days' | translate + } + }} + {{ calculateDaysAgoOfComment(comment.created_at) }} , + + {{ comment.created_at | date: 'short':'Europe/Paris':'fr_FR' }}

@@ -29,29 +37,31 @@
-

Laisser un commentaire

- - - - - - + + + + + + + + + + + + + @@ -65,14 +75,17 @@
- + +
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index b928be32..2534c6e8 100755 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -755,6 +755,7 @@ "your-vote-has-been-saved-but-please-note-you-need-to-keep-this-personalised-link-to-be-able-to-edit-": "Your vote has been saved, but please note: you need to keep this personalized link to be able to edit your vote." }, "LANGUAGES": { + "AR": "Arabic", "DE": "German", "FR": "French", "BR": "Breton", @@ -771,6 +772,22 @@ "OC": "Occitan", "SV": "Swedish" }, + "LANGUAGES_SHORT": { + "AR": "Ar", + "DE": "De", + "FR": "Fr", + "BR": "Br", + "CA": "Ca", + "EL": "el", + "ES": "Es", + "EN": "En", + "GL": "gl", + "HU": "hu", + "IT": "It", + "NL": "Nl", + "OC": "oc", + "SV": "sv" + }, "calendar_widget": { "startsWith": "Starts with", "contains": "Contains", diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index dee777e1..7b7b4b88 100755 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -760,6 +760,7 @@ "your-vote-has-been-saved-but-please-note-you-need-to-keep-this-personalised-link-to-be-able-to-edit-": "Votre vote a bien été pris en compte, mais faites attention : ce sondage n'autorise l'édition de votre vote qu'avec le lien personnalisé suivant ; conservez-le précieusement" }, "LANGUAGES": { + "AR": "Arabe", "DE": "Allemand", "FR": "Français", "BR": "Breton", @@ -777,6 +778,7 @@ "SV": "Suédois" }, "LANGUAGES_SHORT": { + "AR": "Ar", "DE": "De", "FR": "Fr", "BR": "Br", diff --git a/src/styles/partials/_forms.scss b/src/styles/partials/_forms.scss index c7379064..f19abd9a 100644 --- a/src/styles/partials/_forms.scss +++ b/src/styles/partials/_forms.scss @@ -310,6 +310,15 @@ mat-checkbox { .icon { width: 1rem; } + + .columns { + margin-left: 0; + margin-right: 0; + margin-top: 0; + .column { + padding-left: 0; + } + } } // resume de la création de sondage