mirror of
https://framagit.org/framasoft/framadate/funky-framadate-front.git
synced 2023-08-25 13:53:14 +02:00
fill poll config default
This commit is contained in:
parent
40c0c38889
commit
7140072ecc
@ -16,7 +16,9 @@ export class PollConfiguration {
|
||||
public isZeroKnoledge: boolean = true,
|
||||
public hasSeveralHours: boolean = false,
|
||||
public hasMaxCountOfAnswers: boolean = false,
|
||||
public whoCanChangeAnswers: string = 'everybody',
|
||||
public whoCanChangeAnswers: string = environment.poll.defaultConfig.whoCanChangeAnswers, // everybody, self, nobody (= just admin)
|
||||
public visibility: string = environment.poll.defaultConfig.visibility, // visible to anyone with the link:
|
||||
public voteChoices: string = environment.poll.defaultConfig.voteChoices, // possible answers to a vote choice: only "yes", "yes, maybe, no": number = environment.poll.defaultConfig.maxCountOfAnswers,
|
||||
public maxCountOfAnswers: number = environment.poll.defaultConfig.maxCountOfAnswers,
|
||||
public expiresDaysDelay: number = environment.poll.defaultConfig.expiresDaysDelay,
|
||||
public expiracyAfterLastModificationInDays: number = environment.poll.defaultConfig
|
||||
|
@ -13,15 +13,13 @@ export class Poll {
|
||||
public description?: string,
|
||||
public creatorPseudo?: string,
|
||||
public creatorEmail?: string,
|
||||
public isAboutDate?: boolean,
|
||||
public isZeroKnoledge?: boolean,
|
||||
public allowSeveralHours?: boolean,
|
||||
public archiveNumberOfDays?: number,
|
||||
public configuration: PollConfiguration = new PollConfiguration(),
|
||||
public comments: Comment[] = [],
|
||||
public choices: Choice[] = [],
|
||||
public dateChoices: Choice[] = [],
|
||||
public timeChoices: Choice[] = []
|
||||
public dateChoices: Choice[] = [], // sets of days as strings, config to set identical time for days in a special days poll
|
||||
public timeChoices: Choice[] = [] // ranges of time expressed as strings
|
||||
) {}
|
||||
|
||||
public getAdministrationUrl(): string {
|
||||
|
@ -86,6 +86,7 @@ export class PollService implements Resolve<Poll> {
|
||||
* @param config
|
||||
*/
|
||||
makeSlug(config: Poll): string {
|
||||
console.log('config', config);
|
||||
let str = '';
|
||||
str =
|
||||
config.configuration.dateCreated.getFullYear() +
|
||||
|
@ -95,7 +95,7 @@
|
||||
<i class="fa fa-close"></i>
|
||||
</button>
|
||||
</div>
|
||||
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.areResultsPublic">
|
||||
Les participants pourront consulter les résultats
|
||||
</mat-checkbox>
|
||||
<h3 class="title is-3">
|
||||
@ -103,7 +103,7 @@
|
||||
Accès sécurisé
|
||||
</h3>
|
||||
|
||||
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isProtectedByPassword">
|
||||
Le sondage sera protégé par un mot de passe
|
||||
</mat-checkbox>
|
||||
|
||||
@ -114,7 +114,7 @@
|
||||
matInput
|
||||
type="password"
|
||||
placeholder="password"
|
||||
formControlName="password"
|
||||
formControlName="configuration.password"
|
||||
required
|
||||
/>
|
||||
|
||||
@ -122,13 +122,13 @@
|
||||
<i class="fa fa-enveloppe"></i>
|
||||
Notifications
|
||||
</h3>
|
||||
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isOwnerNotifiedByEmailOnNewVote">
|
||||
Vous recevrez un mail à chaque nouvelle participation
|
||||
</mat-checkbox>
|
||||
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isOwnerNotifiedByEmailOnNewComment">
|
||||
Vous recevrez un mail à chaque nouveau commentaire
|
||||
</mat-checkbox>
|
||||
<mat-checkbox class="is-not-flex" formControlName="isMaybeAnswerAvailable">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isMaybeAnswerAvailable">
|
||||
La réponse « peut-être » sera disponible
|
||||
</mat-checkbox>
|
||||
</fieldset>
|
||||
@ -138,27 +138,27 @@
|
||||
Fonctionnalités pas encore disponibles:
|
||||
</h2>
|
||||
<app-wip-todo></app-wip-todo>
|
||||
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isProtectedByPassword">
|
||||
Spécifier un lien unique de vote à des participants définis
|
||||
</mat-checkbox>
|
||||
<mat-checkbox class="is-not-flex" formControlName="allowComments">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.allowComments">
|
||||
Autoriser les commentaires
|
||||
</mat-checkbox>
|
||||
<mat-checkbox class="is-not-flex" formControlName="hasMaxCountOfAnswers">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.hasMaxCountOfAnswers">
|
||||
Nombre de réponses limitées à ce nombre
|
||||
</mat-checkbox>
|
||||
<input
|
||||
*ngIf="form.value.hasMaxCountOfAnswers"
|
||||
*ngIf="form.value.configuration.hasMaxCountOfAnswers"
|
||||
#maxCountOfAnswers
|
||||
id="maxCountOfAnswers"
|
||||
matInput
|
||||
type="number"
|
||||
placeholder="Nombre de réponses max"
|
||||
formControlName="maxCountOfAnswers"
|
||||
formControlName="configuration.maxCountOfAnswers"
|
||||
required
|
||||
/>
|
||||
|
||||
<mat-checkbox class="is-not-flex" formControlName="isZeroKnoledge">
|
||||
<mat-checkbox class="is-not-flex" formControlName="configuration.isZeroKnoledge">
|
||||
Les informations du sondage seront chiffrés en base de données
|
||||
</mat-checkbox>
|
||||
</fieldset>
|
||||
|
@ -26,7 +26,7 @@
|
||||
<app-date-select ng-if="form.value.isAboutDate" [form]="form"></app-date-select>
|
||||
<!-- <app-text-select ng-if="!form.value.isAboutDate" [form]="form"></app-text-select>-->
|
||||
|
||||
<!-- <app-base-config [form]="form"></app-base-config>-->
|
||||
<app-base-config [form]="form"></app-base-config>
|
||||
|
||||
<button class="btn is-info" (click)="advancedDisplayEnabled = !advancedDisplayEnabled">
|
||||
<i class="fa fa-save"></i>
|
||||
|
@ -39,6 +39,8 @@ export class FormComponent implements OnInit {
|
||||
}
|
||||
|
||||
initFormDefault(showDemoValues = true): void {
|
||||
const creationDate = new Date();
|
||||
|
||||
this.form = this.fb.group({
|
||||
title: ['', [Validators.required, Validators.minLength(12)]],
|
||||
creatorPseudo: ['', [Validators.required]],
|
||||
@ -51,29 +53,41 @@ export class FormComponent implements OnInit {
|
||||
imageUrl: ['', [Validators.required]],
|
||||
}),
|
||||
]),
|
||||
dateChoices: this.fb.array([
|
||||
this.fb.group({
|
||||
label: ['', [Validators.required]],
|
||||
// if we have enabled detailed time choices per date choice, we have to make a time property for each date choice
|
||||
timeChoices: this.fb.array([
|
||||
this.fb.group({
|
||||
label: ['', [Validators.required]],
|
||||
}),
|
||||
]),
|
||||
}),
|
||||
]),
|
||||
timeChoices: this.fb.array([
|
||||
this.fb.group({
|
||||
label: ['', [Validators.required]],
|
||||
}),
|
||||
]),
|
||||
configuration: this.fb.group({
|
||||
areResultsPublic: [true, [Validators.required]],
|
||||
whoCanChangeAnswers: ['everybody', [Validators.required]],
|
||||
// isProtectedByPassword: false,
|
||||
// isOwnerNotifiedByEmailOnNewVote: false,
|
||||
// isOwnerNotifiedByEmailOnNewComment: false,
|
||||
// isMaybeAnswerAvailable: false,
|
||||
// areResultsPublic: true,
|
||||
// expiracyNumberOfDays: 60,
|
||||
isProtectedByPassword: [false, [Validators.required]],
|
||||
isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]],
|
||||
isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]],
|
||||
isMaybeAnswerAvailable: [false, [Validators.required]],
|
||||
isAboutDate: [true, [Validators.required]],
|
||||
isZeroKnoledge: [false, [Validators.required]],
|
||||
expiresDaysDelay: [60, [Validators.required, Validators.min(1)]],
|
||||
maxCountOfAnswers: [150, [Validators.required, Validators.min(1)]],
|
||||
allowComments: [true, [Validators.required]],
|
||||
password: [this.uuidService.getUUID(), [Validators.required]],
|
||||
dateCreated: [creationDate, [Validators.required]],
|
||||
hasSeveralHours: [false, [Validators.required]],
|
||||
hasMaxCountOfAnswers: [true, [Validators.required, Validators.min(1)]],
|
||||
}),
|
||||
isAboutDate: [true, [Validators.required]],
|
||||
isProtectedByPassword: [false, [Validators.required]],
|
||||
startDateInterval: ['', [Validators.required]],
|
||||
endDateInterval: ['', [Validators.required]],
|
||||
hasMaxCountOfAnswers: [true, [Validators.required, Validators.min(1)]],
|
||||
hasSeveralHours: [false, [Validators.required]],
|
||||
allowComments: [true, [Validators.required]],
|
||||
maxCountOfAnswers: [150, [Validators.required]],
|
||||
isOwnerNotifiedByEmailOnNewVote: [false, [Validators.required]],
|
||||
isOwnerNotifiedByEmailOnNewComment: [false, [Validators.required]],
|
||||
isMaybeAnswerAvailable: [false, [Validators.required]],
|
||||
areResultsPublic: [true, [Validators.required]],
|
||||
password: [this.uuidService.getUUID(), [Validators.required]],
|
||||
expiracyNumberOfDays: [60, [Validators.required, Validators.min(0)]],
|
||||
});
|
||||
console.log('this.form ', this.form);
|
||||
|
||||
@ -102,7 +116,7 @@ export class FormComponent implements OnInit {
|
||||
isOwnerNotifiedByEmailOnNewComment: false,
|
||||
isMaybeAnswerAvailable: false,
|
||||
areResultsPublic: true,
|
||||
expiracyNumberOfDays: 60,
|
||||
expiresDaysDelay: 60,
|
||||
},
|
||||
comments: [],
|
||||
choices: [],
|
||||
|
@ -9,7 +9,7 @@
|
||||
<div class="card">
|
||||
<header class="card-header">
|
||||
<p class="card-header-title">{{ poll.title }}</p>
|
||||
<p class="card-header-icon">author : {{ poll.owner?.pseudo }}</p>
|
||||
<!-- <p class="card-header-icon">author : {{ poll.owner?.pseudo }}</p>-->
|
||||
</header>
|
||||
<div class="card-content">
|
||||
<div class="content">
|
||||
|
@ -57,6 +57,9 @@ export const environment = {
|
||||
maxCountOfAnswers: 150,
|
||||
expiresDaysDelay: 60,
|
||||
expiracyAfterLastModificationInDays: 180,
|
||||
whoCanChangeAnswers: 'everybody',
|
||||
visibility: 'link_only',
|
||||
voteChoices: 'only_yes',
|
||||
},
|
||||
},
|
||||
localStorage: {
|
||||
|
Loading…
Reference in New Issue
Block a user