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