fix deps to config prop

This commit is contained in:
Tykayn 2021-04-30 23:43:44 +02:00 committed by tykayn
parent c302663994
commit e7343810d5
3 changed files with 13 additions and 19 deletions

View File

@ -37,6 +37,10 @@ export class Poll {
public has_several_hours?: boolean = false; public has_several_hours?: boolean = false;
public hasSeveralHours?: boolean = false; public hasSeveralHours?: boolean = false;
public isOwnerNotifiedByEmailOnNewVote?: boolean = true;
public isOwnerNotifiedByEmailOnNewComment?: boolean = true;
public isMaybeAnswerAvailable?: boolean = true;
public areResultsPublic?: boolean = true;
public allowSeveralHours?: boolean; public allowSeveralHours?: boolean;

View File

@ -30,29 +30,19 @@ export class StepperComponent implements OnInit {
}); });
this.configurationFormGroup = this.fb.group({ this.configurationFormGroup = this.fb.group({
title: [this.poll ? this.poll.configuration : false, [Validators.required]], title: [this.poll ? this.poll : false, [Validators.required]],
isAboutDate: [this.poll ? this.poll.configuration.isAboutDate : false, [Validators.required]], isAboutDate: [this.poll ? this.poll.kind === 'date' : false, [Validators.required]],
isProtectedByPassword: [ isProtectedByPassword: [this.poll ? this.poll.password.length : false, [Validators.required]],
this.poll ? this.poll.configuration.isProtectedByPassword : false,
[Validators.required],
],
isOwnerNotifiedByEmailOnNewVote: [ isOwnerNotifiedByEmailOnNewVote: [
this.poll ? this.poll.configuration.isOwnerNotifiedByEmailOnNewVote : false, this.poll ? this.poll.isOwnerNotifiedByEmailOnNewVote : false,
[Validators.required], [Validators.required],
], ],
isOwnerNotifiedByEmailOnNewComment: [ isOwnerNotifiedByEmailOnNewComment: [
this.poll ? this.poll.configuration.isOwnerNotifiedByEmailOnNewComment : false, this.poll ? this.poll.isOwnerNotifiedByEmailOnNewComment : false,
[Validators.required],
],
isMaybeAnswerAvailable: [
this.poll ? this.poll.configuration.isMaybeAnswerAvailable : false,
[Validators.required],
],
areResultsPublic: [this.poll ? this.poll.configuration.areResultsPublic : true, [Validators.required]],
expiracyNumberOfDays: [
this.poll ? DateService.diffInDays(new Date(), this.poll.configuration.expiracyDate) : 60,
[Validators.required], [Validators.required],
], ],
areResultsPublic: [this.poll ? this.poll.areResultsPublic : true, [Validators.required]],
expiracyNumberOfDays: [this.poll ? this.poll.default_expiracy_days_from_now : '60', [Validators.required]],
}); });
} }

View File

@ -12,7 +12,7 @@
class="button" class="button"
[ngClass]="{ 'is-selected is-warning': answer == 'MAYBE' }" [ngClass]="{ 'is-selected is-warning': answer == 'MAYBE' }"
(click)="vote('MAYBE')" (click)="vote('MAYBE')"
*ngIf="poll.configuration.isMaybeAnswerAvailable" *ngIf="poll.isMaybeAnswerAvailable"
> >
MAYBE MAYBE
</button> </button>
@ -27,7 +27,7 @@
{{ choice.counts.get(answerEnum.YES) }} {{ choice.counts.get(answerEnum.YES) }}
<img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" /> <img class="image is-24x24" src="../../../assets/img/icon_voter_YES.svg" />
</button> </button>
<button class="button is-white" *ngIf="poll.configuration.isMaybeAnswerAvailable"> <button class="button is-white" *ngIf="poll.isMaybeAnswerAvailable">
{{ choice.counts.get(answerEnum.MAYBE) }} {{ choice.counts.get(answerEnum.MAYBE) }}
<img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" /> <img class="image is-24x24" src="../../../assets/img/icon_voter_MAYBE.svg" />
</button> </button>