mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
fix cancel modal
This commit is contained in:
parent
e4689a5e71
commit
8035ea700e
@ -114,7 +114,7 @@ export class PollService implements Resolve<Poll> {
|
|||||||
public createFormGroup() {
|
public createFormGroup() {
|
||||||
let minlengthValidation = environment.production ? 12 : 0;
|
let minlengthValidation = environment.production ? 12 : 0;
|
||||||
let form = this.fb.group({
|
let form = this.fb.group({
|
||||||
title: ['défault titre', [Validators.required, Validators.minLength(minlengthValidation)]],
|
title: ['', [Validators.required, Validators.minLength(minlengthValidation)]],
|
||||||
creatorPseudo: ['', []],
|
creatorPseudo: ['', []],
|
||||||
created_at: [new Date(), [Validators.required]],
|
created_at: [new Date(), [Validators.required]],
|
||||||
creatorEmail: ['', [environment.creation_email_is_required ? Validators.required : null]],
|
creatorEmail: ['', [environment.creation_email_is_required ? Validators.required : null]],
|
||||||
@ -176,7 +176,6 @@ export class PollService implements Resolve<Poll> {
|
|||||||
* get a new slug from form title and creation date
|
* get a new slug from form title and creation date
|
||||||
*/
|
*/
|
||||||
public updateSlug(): void {
|
public updateSlug(): void {
|
||||||
console.log('this.form.value', this.form.value);
|
|
||||||
this.form.patchValue({ custom_url: this.makeSlug(this.form) });
|
this.form.patchValue({ custom_url: this.makeSlug(this.form) });
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -713,7 +712,6 @@ export class PollService implements Resolve<Poll> {
|
|||||||
*/
|
*/
|
||||||
newPollFromForm(): Poll {
|
newPollFromForm(): Poll {
|
||||||
let form = this.form;
|
let form = this.form;
|
||||||
console.log('this.form.value', this.form.value);
|
|
||||||
const newOwner = this.storageService.vote_stack.owner;
|
const newOwner = this.storageService.vote_stack.owner;
|
||||||
|
|
||||||
const newpoll = new Poll(newOwner, form.value.custom_url, form.value.title);
|
const newpoll = new Poll(newOwner, form.value.custom_url, form.value.title);
|
||||||
|
@ -36,6 +36,7 @@ import { TextListComponent } from './form/text-list/text-list.component';
|
|||||||
import { HoursComponent } from './form/hours/hours.component';
|
import { HoursComponent } from './form/hours/hours.component';
|
||||||
import { ActionsMenuComponent } from './actions-menu/actions-menu.component';
|
import { ActionsMenuComponent } from './actions-menu/actions-menu.component';
|
||||||
import { NavStepsComponent } from './nav-steps/nav-steps.component';
|
import { NavStepsComponent } from './nav-steps/nav-steps.component';
|
||||||
|
import { DialogModule } from 'primeng/dialog';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
@ -78,6 +79,7 @@ import { NavStepsComponent } from './nav-steps/nav-steps.component';
|
|||||||
TranslateModule.forChild({ extend: true }),
|
TranslateModule.forChild({ extend: true }),
|
||||||
DragDropModule,
|
DragDropModule,
|
||||||
ConfirmDialogModule,
|
ConfirmDialogModule,
|
||||||
|
DialogModule,
|
||||||
],
|
],
|
||||||
exports: [ActionsMenuComponent],
|
exports: [ActionsMenuComponent],
|
||||||
})
|
})
|
||||||
|
@ -7,6 +7,7 @@ import { ToastService } from '../../../core/services/toast.service';
|
|||||||
import { PollService } from '../../../core/services/poll.service';
|
import { PollService } from '../../../core/services/poll.service';
|
||||||
import { DOCUMENT } from '@angular/common';
|
import { DOCUMENT } from '@angular/common';
|
||||||
import { ActivatedRoute, Router } from '@angular/router';
|
import { ActivatedRoute, Router } from '@angular/router';
|
||||||
|
import { environment } from '../../../../environments/environment';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-admin-form',
|
selector: 'app-admin-form',
|
||||||
@ -33,7 +34,9 @@ export class FormComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ngOnInit(): void {
|
ngOnInit(): void {
|
||||||
this.pollService.askInitFormDefault();
|
if (environment.autofill_creation) {
|
||||||
|
this.pollService.askInitFormDefault();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
goNextStep() {}
|
goNextStep() {}
|
||||||
|
@ -42,7 +42,7 @@
|
|||||||
maxlength="300"
|
maxlength="300"
|
||||||
></textarea>
|
></textarea>
|
||||||
<div
|
<div
|
||||||
class="text-info padded"
|
class="text-info"
|
||||||
[ngClass]="{ 'has-background-warning': pollService.form.value.description.length === 300 }"
|
[ngClass]="{ 'has-background-warning': pollService.form.value.description.length === 300 }"
|
||||||
>
|
>
|
||||||
<span class="counter-current" *ngIf="pollService.form.value.description.length">
|
<span class="counter-current" *ngIf="pollService.form.value.description.length">
|
||||||
|
@ -74,4 +74,34 @@
|
|||||||
<div class="step-bar-container" style="width: 100%;">
|
<div class="step-bar-container" style="width: 100%;">
|
||||||
<div class="step-bar-progress" [ngStyle]="{ width: (step_current / step_max) * 100 + '%' }"></div>
|
<div class="step-bar-progress" [ngStyle]="{ width: (step_current / step_max) * 100 + '%' }"></div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- modale pour quitter la création-->
|
||||||
|
<p-dialog
|
||||||
|
header="Quitter?"
|
||||||
|
[modal]="true"
|
||||||
|
[(visible)]="display_cancel_dialog"
|
||||||
|
[breakpoints]="{ '960px': '75vw' }"
|
||||||
|
[style]="{ width: '50vw' }"
|
||||||
|
[draggable]="false"
|
||||||
|
[resizable]="false"
|
||||||
|
>
|
||||||
|
<p>Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.</p>
|
||||||
|
<ng-template pTemplate="footer">
|
||||||
|
<div class="columns">
|
||||||
|
<div class="column">
|
||||||
|
<button class="button is-warning is-fullwidth cancel-button-confirm" (click)="goToHome()">
|
||||||
|
Quitter
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
<div class="column">
|
||||||
|
<button
|
||||||
|
class="button is-primary is-fullwidth cancel-button-reject"
|
||||||
|
(click)="display_cancel_dialog = false"
|
||||||
|
>
|
||||||
|
Rester
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</ng-template>
|
||||||
|
</p-dialog>
|
||||||
</section>
|
</section>
|
||||||
|
@ -77,4 +77,10 @@
|
|||||||
.step-counter-text {
|
.step-counter-text {
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
.cancel-button-reject,
|
||||||
|
.cancel-button-confirm {
|
||||||
|
display: block !important;
|
||||||
|
width: 100%;
|
||||||
|
color: white !important;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,7 @@ export class StepperComponent {
|
|||||||
public step_max: number = 5;
|
public step_max: number = 5;
|
||||||
public environment = environment;
|
public environment = environment;
|
||||||
public show_shortcuts = environment.showStepperShortcuts;
|
public show_shortcuts = environment.showStepperShortcuts;
|
||||||
|
display_cancel_dialog: boolean;
|
||||||
constructor(
|
constructor(
|
||||||
public pollService: PollService,
|
public pollService: PollService,
|
||||||
private confirmationService: ConfirmationService,
|
private confirmationService: ConfirmationService,
|
||||||
@ -28,17 +29,10 @@ export class StepperComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
showCancelDialog() {
|
showCancelDialog() {
|
||||||
this.confirmationService.confirm({
|
this.display_cancel_dialog = true;
|
||||||
header: 'Quitter ?',
|
|
||||||
acceptLabel: 'Quitter',
|
|
||||||
rejectLabel: 'Rester',
|
|
||||||
message: 'Souhaitez-vous vraiment quitter le sondage ? Toutes les informations seront effacées.',
|
|
||||||
accept: () => this.goToHome(),
|
|
||||||
reject: () => console.log('rejected'),
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
goToHome() {
|
goToHome() {
|
||||||
this.confirmationService.close();
|
this.display_cancel_dialog = false;
|
||||||
this.router.navigate(['/']);
|
this.router.navigate(['/']);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,3 @@
|
|||||||
|
#lang_selector {
|
||||||
|
background: white;
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user