action before next in nav

This commit is contained in:
Tykayn 2021-12-13 15:30:00 +01:00 committed by tykayn
parent 24653ba480
commit e4fd637cb4
7 changed files with 27 additions and 13 deletions

View File

@ -30,6 +30,7 @@
</div> </div>
</div> </div>
<app-nav-steps <app-nav-steps
[actionBeforeNextStep]="changeDateInputMode"
[next_step_number]="pollService.step_current + 1" [next_step_number]="pollService.step_current + 1"
[previous_step_number]="pollService.step_current - 1" [previous_step_number]="pollService.step_current - 1"
></app-nav-steps> ></app-nav-steps>

View File

@ -12,7 +12,7 @@
<div <div
class="button input-radio is-fullwidth" class="button input-radio is-fullwidth"
[ngClass]="{ [ngClass]="{
'is-selected': pollService.form.controls.isAboutDate.value 'is-selected': pollService.form.controls.isAboutDate.value !== false
}" }"
(click)="pollService.form.controls.isAboutDate.setValue(true)" (click)="pollService.form.controls.isAboutDate.setValue(true)"
> >
@ -27,7 +27,7 @@
<div <div
class="button input-radio is-fullwidth" class="button input-radio is-fullwidth"
[ngClass]="{ [ngClass]="{
'is-selected': !pollService.form.controls.isAboutDate.value 'is-selected': !pollService.form.controls.isAboutDate.value !== false
}" }"
(click)="pollService.form.controls.isAboutDate.setValue(false)" (click)="pollService.form.controls.isAboutDate.setValue(false)"
> >

View File

@ -13,7 +13,7 @@
class="button button-next pull-right" class="button button-next pull-right"
[ngClass]="{ 'is-finish': is_finish_step, 'is-primary': !is_finish_step }" [ngClass]="{ 'is-finish': is_finish_step, 'is-primary': !is_finish_step }"
[routerLink]="['/administration/step/' + next_step_number]" [routerLink]="['/administration/step/' + next_step_number]"
(click)="runEndAction()" (click)="runNextAction()"
> >
<span *ngIf="is_finish_step"> <span *ngIf="is_finish_step">
Enregistrer Enregistrer

View File

@ -18,12 +18,23 @@ export class NavStepsComponent implements OnInit {
display_previous_button = true; display_previous_button = true;
@Input() @Input()
is_finish_step = false; is_finish_step = false;
/**
* some action to perform before changing route
*/
@Input()
actionBeforeNextStep: Function;
constructor(private router: Router, public pollService: PollService) {} constructor(private router: Router, public pollService: PollService) {}
ngOnInit(): void {} ngOnInit(): void {}
runEndAction() { /**
* launch custom function before next step
*/
runNextAction() {
if (this.actionBeforeNextStep) {
this.actionBeforeNextStep();
}
if (this.is_finish_step) { if (this.is_finish_step) {
this.createPoll(); this.createPoll();
} }

View File

@ -65,12 +65,10 @@ p-calendar,
background: $white; background: $white;
} }
$cell-size: 30px;
.p-datepicker-calendar { .p-datepicker-calendar {
td { td {
width: $cell-size; width: $cell-size;
padding: 0.25rem; padding: 0.15rem;
} }
td span, td span,

View File

@ -274,7 +274,7 @@ mat-checkbox {
.step { .step {
max-width: $main-column-width; max-width: $main-column-width;
margin: 0 auto; margin: 0 auto;
padding: 2rem 1rem; padding: 5rem 1rem;
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;
@extend .top-padding-nav; @extend .top-padding-nav;

View File

@ -68,12 +68,16 @@ $default_font: 'helvetica', 'proza_libre', 'Arial', 'DejaVu Sans Mono';
$title_font: 'helvetica', 'proza_libre', 'Arial', 'DejaVu Sans Mono'; $title_font: 'helvetica', 'proza_libre', 'Arial', 'DejaVu Sans Mono';
// sizes and breakpoints // sizes and breakpoints
$main-column-width: 400px; $main-column-width: 25rem;
$main-column-width-inner: 380px; $main-column-width-inner: 23.75rem;
$mobile-size: 400px; $mobile-size: 25rem;
$header-nav-height: 68px; $header-nav-height: 4.25rem;
$header-nav-inner-height: 60px; $header-nav-inner-height: 4rem;
// datepicker
$cell-size: 30px;
// css vars
:root { :root {
--main-col-width: $main-column-width-inner; --main-col-width: $main-column-width-inner;
} }