From e9850bca2da81326c0e455355dd021b34b1d82e3 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Thu, 10 Feb 2022 12:16:11 +0100 Subject: [PATCH] display text choices in consultation --- src/app/core/services/poll.service.ts | 6 +- .../actions-menu/actions-menu.component.html | 49 +++++----- .../actions-menu/actions-menu.component.ts | 4 +- .../success/success.component.html | 9 +- .../choice-table/choice-table.component.html | 53 +++++++++++ .../choice-table/choice-table.component.scss | 0 .../choice-table.component.spec.ts | 24 +++++ .../choice-table/choice-table.component.ts | 15 +++ .../consultation/consultation.component.html | 92 ++++++++----------- .../consultation/consultation.component.scss | 7 ++ .../consultation/consultation.component.ts | 9 +- .../consultation/consultation.module.ts | 2 + .../poll-results-dinum.component.html | 92 +++++-------------- src/assets/i18n/en.json | 2 + src/assets/i18n/fr.json | 2 + 15 files changed, 202 insertions(+), 164 deletions(-) create mode 100644 src/app/features/consultation/choice-table/choice-table.component.html create mode 100644 src/app/features/consultation/choice-table/choice-table.component.scss create mode 100644 src/app/features/consultation/choice-table/choice-table.component.spec.ts create mode 100644 src/app/features/consultation/choice-table/choice-table.component.ts diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index de6510bb..998da138 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -611,8 +611,9 @@ export class PollService implements Resolve { public getParticipationUrl(): string { // http://localhost:4200/#/poll/dessin-anime/consultation - // TODO handle secure access + // handle secure access // http://localhost:4200/#/poll/citron/consultation/secure/1c01ed9c94fc640a1be864f197ff808c + // http://localhost:4200/#/poll/citron/consultation/prompt pour entrer le pass à double hasher en md5 let url = ''; let suffix_password = ''; @@ -631,7 +632,6 @@ export class PollService implements Resolve { url = `${environment.frontDomain}/#/poll/${this.form.value.custom_url}/consultation${suffix_password}`; } - console.log('getParticipationUrl', url); return url; } @@ -801,7 +801,7 @@ export class PollService implements Resolve { */ copyText(textToCopy: string) { this._clipboardService.copyFromContent(textToCopy); - console.log("this.translate.get('success.copy_message')", this.translate.get('success.copy_message')); + this.translate.get('success.copy_message').subscribe((resp) => { console.log('resp', resp); this.toastService.display(`${resp} ${textToCopy}`); diff --git a/src/app/features/administration/actions-menu/actions-menu.component.html b/src/app/features/administration/actions-menu/actions-menu.component.html index c6766ed8..0d8f9175 100644 --- a/src/app/features/administration/actions-menu/actions-menu.component.html +++ b/src/app/features/administration/actions-menu/actions-menu.component.html @@ -1,55 +1,50 @@
- - - -
- -
-
+ + + + + + + + +
diff --git a/src/app/features/administration/actions-menu/actions-menu.component.ts b/src/app/features/administration/actions-menu/actions-menu.component.ts index 6e28aed1..33bf5277 100644 --- a/src/app/features/administration/actions-menu/actions-menu.component.ts +++ b/src/app/features/administration/actions-menu/actions-menu.component.ts @@ -1,4 +1,4 @@ -import { Component, OnInit } from '@angular/core'; +import { Component, Input, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { PollUtilitiesService } from '../../../core/services/poll.utilities.service'; import { StorageService } from '../../../core/services/storage.service'; @@ -14,6 +14,8 @@ import { ConfirmationService } from 'primeng/api'; styleUrls: ['./actions-menu.component.scss'], }) export class ActionsMenuComponent implements OnInit { + @Input() displayMenu = false; + constructor( private router: Router, private utils: PollUtilitiesService, diff --git a/src/app/features/administration/success/success.component.html b/src/app/features/administration/success/success.component.html index dd9da3fa..83b99c63 100644 --- a/src/app/features/administration/success/success.component.html +++ b/src/app/features/administration/success/success.component.html @@ -39,12 +39,9 @@ />
- +
diff --git a/src/app/features/consultation/choice-table/choice-table.component.html b/src/app/features/consultation/choice-table/choice-table.component.html new file mode 100644 index 00000000..30f4a3c0 --- /dev/null +++ b/src/app/features/consultation/choice-table/choice-table.component.html @@ -0,0 +1,53 @@ +
+
+
+ {{ 'participation.yes' | translate }} +
+
+
+ {{ choice.yes.count }} +
+
+
+
+
+ {{ 'participation.maybe' | translate }} +
+
+
+ {{ choice.maybe.count }} +
+
+
+
+
+ {{ 'participation.no' | translate }} +
+
+
+ {{ choice.no.count }} +
+
+
+
+
+

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

+
+
+ icone ok {{ peopleName }} +
+
+
+
+ icone ok {{ peopleName }} +
+
+
+
+ icone ok {{ peopleName }} +
+
+
diff --git a/src/app/features/consultation/choice-table/choice-table.component.scss b/src/app/features/consultation/choice-table/choice-table.component.scss new file mode 100644 index 00000000..e69de29b diff --git a/src/app/features/consultation/choice-table/choice-table.component.spec.ts b/src/app/features/consultation/choice-table/choice-table.component.spec.ts new file mode 100644 index 00000000..10cd1d3e --- /dev/null +++ b/src/app/features/consultation/choice-table/choice-table.component.spec.ts @@ -0,0 +1,24 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ChoiceTableComponent } from './choice-table.component'; + +describe('ChoiceTableComponent', () => { + let component: ChoiceTableComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ChoiceTableComponent], + }).compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ChoiceTableComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/features/consultation/choice-table/choice-table.component.ts b/src/app/features/consultation/choice-table/choice-table.component.ts new file mode 100644 index 00000000..c89dfba2 --- /dev/null +++ b/src/app/features/consultation/choice-table/choice-table.component.ts @@ -0,0 +1,15 @@ +import { Component, Input, OnInit } from '@angular/core'; +import { Choice } from '../../../core/models/choice.model'; + +@Component({ + selector: 'app-choice-table', + templateUrl: './choice-table.component.html', + styleUrls: ['./choice-table.component.scss'], +}) +export class ChoiceTableComponent implements OnInit { + @Input() detailledDisplay: boolean; + @Input() choice: Choice; + constructor() {} + + ngOnInit(): void {} +} diff --git a/src/app/features/consultation/consultation.component.html b/src/app/features/consultation/consultation.component.html index dc408489..4085fec8 100644 --- a/src/app/features/consultation/consultation.component.html +++ b/src/app/features/consultation/consultation.component.html @@ -1,68 +1,45 @@ - +
-
-
-
- -
-
- -
-
- -
+
+ +

{{ poll.title }}

-
+
-

{{ poll.description }}

+ + Les votes sont désactivés @@ -115,16 +99,12 @@
+ +
+ Résultats cachés aux visiteurs +
- - - - - - - -

@@ -133,9 +113,9 @@
- - - +
+ Ce sondage ne permet pas d'ajouter de commentaires +

diff --git a/src/app/features/consultation/consultation.component.scss b/src/app/features/consultation/consultation.component.scss index 4dcb562c..b7b7f16b 100644 --- a/src/app/features/consultation/consultation.component.scss +++ b/src/app/features/consultation/consultation.component.scss @@ -13,3 +13,10 @@ min-height: 2rem; } } +.options-button { + border: 0; + background: transparent; +} +.vote-button { + margin-right: 2rem; +} diff --git a/src/app/features/consultation/consultation.component.ts b/src/app/features/consultation/consultation.component.ts index 78290b01..acddbc8a 100644 --- a/src/app/features/consultation/consultation.component.ts +++ b/src/app/features/consultation/consultation.component.ts @@ -17,7 +17,6 @@ import { environment } from 'src/environments/environment'; }) export class ConsultationComponent implements OnInit, OnDestroy { public fetching = true; - public environment = environment; private routeSubscription: Subscription; window: any; @@ -25,8 +24,10 @@ export class ConsultationComponent implements OnInit, OnDestroy { public poll: Poll; public pollSlug: string; public pass_hash: string; - maxYesCount: any = 1; - detailledDisplay: boolean = false; + public maxYesCount: any = 1; + public detailledDisplay: boolean = false; + public display_options_menu: boolean = false; + public show_admin_stuff: boolean = true; constructor( private router: Router, @@ -83,7 +84,7 @@ export class ConsultationComponent implements OnInit, OnDestroy { } displayOptions() { - alert('TODO'); + this.display_options_menu = !this.display_options_menu; } /** diff --git a/src/app/features/consultation/consultation.module.ts b/src/app/features/consultation/consultation.module.ts index 8cfb8191..92c0934c 100644 --- a/src/app/features/consultation/consultation.module.ts +++ b/src/app/features/consultation/consultation.module.ts @@ -16,6 +16,7 @@ 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'; +import { ChoiceTableComponent } from './choice-table/choice-table.component'; @NgModule({ declarations: [ @@ -30,6 +31,7 @@ import { PollResultsDinumComponent } from './poll-results-dinum/poll-results-din EditComponent, ResultsRoundedComponent, PollResultsDinumComponent, + ChoiceTableComponent, ], imports: [ CommonModule, 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 index 79c59f7f..e54fa00c 100644 --- 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 @@ -1,79 +1,37 @@ +
+
+
+ {{ choice.date_string }} +
+ +
+
{{ showAsDate(group.date_string) | date: 'fullDate':'Europe/Paris' }}
-
-
-
-
- {{ choice.name }} +
+
+
+
+
+ {{ choice.name }} +
+
+
+ + + +
+
+
-
- - - -
-
-
-
-
-
+
-
-
-
- {{ 'participation.yes' | translate }} -
-
-
- {{ choice.yes.count }} -
-
-
-
-
- {{ 'participation.maybe' | translate }} -
-
-
- {{ choice.maybe.count }} -
-
-
-
-
- {{ 'participation.no' | translate }} -
-
-
- {{ choice.no.count }} -
-
-
-
-
-

- {{ 'participation.details' | translate }} - -

-
-
- icone ok {{ peopleName }} -
-
-
-
- icone ok {{ peopleName }} -
-
-
-
- icone ok {{ peopleName }} -
-
+
diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index ea113b9d..f3f6537f 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -262,6 +262,8 @@ "vote": "Vote", "menu_label": "Options", "end_of_poll": "Poll votes end on", + "share_title": "Tell your voters that your poll is ready !", + "share_description": "All people having the link will be able to participate.", "fav_title": "Vote", "fav_description_one": "The preferred choice with {{maxYesCount}} yes is", "fav_description_several": "The preferred choices are", diff --git a/src/assets/i18n/fr.json b/src/assets/i18n/fr.json index 368104b8..89697535 100755 --- a/src/assets/i18n/fr.json +++ b/src/assets/i18n/fr.json @@ -272,6 +272,8 @@ "vote": "Voter", "menu_label": "Options", "end_of_poll": "Fin du sondage le", + "share_title": "Informez les participants que votre sondage est prêt !", + "share_description": "Toutes personne disposant du lien pourra voter.", "fav_title": "Voter", "fav_description_one": "Le choix préféré avec {{maxYesCount}} oui est", "fav_description_several": "Les choix préférés sont",