From 1307b9f1a351bd7036d72610b47849a7859b19a5 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Wed, 1 Dec 2021 19:00:00 +0100 Subject: [PATCH] only one popup confirm --- .../stepper/stepper.component.html | 33 +++++-------------- .../stepper/stepper.component.ts | 21 ++++++++---- src/assets/i18n/FR.json | 1 + 3 files changed, 24 insertions(+), 31 deletions(-) diff --git a/src/app/features/administration/stepper/stepper.component.html b/src/app/features/administration/stepper/stepper.component.html index e6c00e15..296faeb0 100644 --- a/src/app/features/administration/stepper/stepper.component.html +++ b/src/app/features/administration/stepper/stepper.component.html @@ -62,34 +62,19 @@

Étape {{ step_current }} sur {{ step_max }}

- Annuler + + Annuler +
+
- - - - -

{{ 'creation.dialog' | translate }}

-
- - - - -
diff --git a/src/app/features/administration/stepper/stepper.component.ts b/src/app/features/administration/stepper/stepper.component.ts index 932ce04d..14609cf2 100644 --- a/src/app/features/administration/stepper/stepper.component.ts +++ b/src/app/features/administration/stepper/stepper.component.ts @@ -10,6 +10,9 @@ import { Router } from '@angular/router'; styleUrls: ['./stepper.component.scss'], }) export class StepperComponent { + @Input() + public stepperConfirm: HTMLElement; + @Input() public step_current: number = 1; @Input() @@ -20,16 +23,20 @@ export class StepperComponent { public pollService: PollService, private confirmationService: ConfirmationService, private router: Router - ) {} + ) { + this.step_current = this.pollService.step_current; + } showCancelDialog() { this.confirmationService.confirm({ - message: 'Quitter la création de sondage?', - header: "Retour à l' accueil", - reject: () => {}, - accept: () => { - this.router.navigate(['/']); - }, + header: 'Quitter ?', + message: 'Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.', + accept: () => this.goToHome(), + reject: () => console.log('rejected'), }); } + goToHome() { + this.confirmationService.close(); + this.router.navigate(['/']); + } } diff --git a/src/assets/i18n/FR.json b/src/assets/i18n/FR.json index d3f8edd5..3e6c0f19 100644 --- a/src/assets/i18n/FR.json +++ b/src/assets/i18n/FR.json @@ -34,6 +34,7 @@ "title": "Créer un sondage", "want": "Choisissez le type de sondage", "dialog": "Quitter la création de sondage?", + "dialog_content": "Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.", "advanced": "Options avancées", "kind": { "classic": "Propositions",