display in advanced params

This commit is contained in:
Tykayn 2022-02-04 15:57:21 +01:00 committed by tykayn
parent 191d87d0a5
commit 3a51474a53
5 changed files with 224 additions and 85 deletions

View File

@ -122,15 +122,13 @@ export class PollService implements Resolve<Poll> {
custom_url: [this.uuidService.getUUID(), [Validators.required]],
description: ['', []],
password: ['', []],
password_repeat: ['', []],
choices: new FormArray([]),
whoModifiesAnswers: ['', [Validators.required]],
whoCanChangeAnswers: ['', [Validators.required]],
whoModifiesAnswers: ['self', [Validators.required]],
whoCanChangeAnswers: ['self', [Validators.required]],
isAboutDate: [true, [Validators.required]],
expiresDaysDelay: [environment.expiresDaysDelay, []],
expiracy_date: [
this.DateUtilitiesService.addDaysToDate(environment.expiresDaysDelay, new Date()),
[Validators.required],
],
expiracy_date: [this.DateUtilitiesService.addDaysToDate(environment.expiresDaysDelay, new Date()), []],
isZeroKnoledge: [false, [Validators.required]],
isProtectedByPassword: [false, [Validators.required]],
isOwnerNotifiedByEmailOnNewVote: [true, [Validators.required]],

View File

@ -17,12 +17,30 @@
/>
</div>
</div>
<hr />
<div class="rounded-block">
<h3 class="title is-3">
{{ 'advanced.custom_link' | translate }}
</h3>
<label for="custom_url">
Url personnalisée pour les participants
{{ 'advanced.custom_label' | translate }}
</label>
<p class="description small-text">
{{ 'advanced.custom_desc' | translate }}
</p>
<br />
<div class="domain-custom-box">
<div class="domain">{{ domain_url }}</div>
<input
class="inline-input"
#custom_url
matInput
id="custom_url"
placeholder="Url"
formControlName="custom_url"
required
/>
</div>
<button
*ngIf="form.controls.custom_url.value"
aria-label="Clear"
@ -30,40 +48,20 @@
>
<i class="fa fa-recycle"></i> régénérer
</button>
<input #custom_url matInput id="custom_url" placeholder="Url" formControlName="custom_url" required />
</div>
<br />
<div appearance="outline" class="is-not-flex">
<mat-label
>Nombre de jours avant expiration de la possibilité de voter, après le sondage reste consultable
</mat-label>
<input
#expiresDaysDelay
id="expiresDaysDelay"
matInput
type="number"
formControlName="expiresDaysDelay"
required
/>
</div>
<div class="rounded-box">
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
Les participants pourront consulter les résultats
</mat-checkbox>
</div>
<div class="rounded-box">
<div class="rounded-block">
<h3 class="title is-3">
{{ 'advanced.password_title' | translate }}
</h3>
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
{{ 'advanced.password_label' | translate }}
</mat-checkbox>
</div>
<div class="password-box" *ngIf="form.value.isProtectedByPassword">
<p>
{{ 'advanced.password_title' | translate }}
</p>
<div class="password-box">
<input
#password
id="password"
id="password_first"
matInput
[type]="displayClearPassword ? 'text' : 'password'"
formControlName="password"
@ -78,6 +76,107 @@
<i class="fa fa-eye" *ngIf="!displayClearPassword"></i>
<i class="fa fa-eye-slash" *ngIf="displayClearPassword"></i>
</button>
<input
#password
id="password"
matInput
[type]="displayClearPassword ? 'text' : 'password'"
formControlName="password_repeat"
required
/>
<button
class="button"
[ngClass]="{ 'is-primary': displayClearPassword, 'is-info': !displayClearPassword }"
(click)="displayClearPassword = !displayClearPassword"
>
voir
<i class="fa fa-eye" *ngIf="!displayClearPassword"></i>
<i class="fa fa-eye-slash" *ngIf="displayClearPassword"></i>
</button>
<div class="pass-validation" *ngIf="form.value.password == form.value.password_repeat">
<img class="icon" aria-hidden="true" src="assets/icons/book.svg" />
{{ 'advanced.password_validation_ok' | translate }}
</div>
<div class="visibility_password_results">
<mat-checkbox class="is-not-flex" formControlName="areResultsPublic">
{{ 'advanced.password_display_without' | translate }}
</mat-checkbox>
</div>
</div>
</div>
<div class="rounded-block permissions-modification">
<h3 class="title is-3">
{{ 'advanced.allowances_title' | translate }}
</h3>
<div class="choice">
<label for="self_can_change_answers">
{{ 'advanced.allowances_own' | translate }}
</label>
<input type="radio" formControlName="whoCanChangeAnswers" value="self" id="self_can_change_answers" />
</div>
<div class="choice">
<label for="everybody_can_change_answers">
{{ 'advanced.allowances_all' | translate }}
</label>
<input
type="radio"
formControlName="whoCanChangeAnswers"
value="everybody"
id="everybody_can_change_answers"
/>
</div>
<hr />
<div class="choice">
<label for="none_can_change_answers">
{{ 'advanced.allowances_none' | translate }}
</label>
<input type="radio" formControlName="whoCanChangeAnswers" value="none" id="none_can_change_answers" />
</div>
</div>
<div class="rounded-block notifications">
<h3 class="title is-3">
{{ 'advanced.notifications_title' | translate }}
</h3>
<p>
{{ 'advanced.notifications_description' | translate }}
</p>
<div class="choice">
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewComment">
{{ 'advanced.notifications_vote' | translate }}
</mat-checkbox>
</div>
<div class="choice">
<mat-checkbox class="is-not-flex" formControlName="isOwnerNotifiedByEmailOnNewVote">
{{ 'advanced.notifications_comment' | translate }}
</mat-checkbox>
</div>
</div>
<!-- hidden configs, work in progress-->
<fieldset class="work-in-progress" *ngIf="environment.display_wip">
<div class="rounded-block archive_config">
<div appearance="outline" class="is-not-flex">
<mat-label
>Nombre de jours avant expiration de la possibilité de voter, après le sondage reste consultable
</mat-label>
<input
#expiresDaysDelay
id="expiresDaysDelay"
matInput
type="number"
formControlName="expiresDaysDelay"
required
/>
</div>
<div class="rounded-box"></div>
<div class="rounded-box">
<h3 class="title is-3">
{{ 'advanced.password_title' | translate }}
</h3>
<mat-checkbox class="is-not-flex" formControlName="isProtectedByPassword">
{{ 'advanced.password_label' | translate }}
</mat-checkbox>
</div>
<h3 class="title is-3">
@ -131,8 +230,6 @@
</p>
</div>
<!-- hidden configs, work in progress-->
<fieldset class="work-in-progress" *ngIf="environment.display_wip">
<h2 class="title is-2">
<i class="fa fa-wikidata"></i>
Fonctionnalités pas encore disponibles:

View File

@ -5,9 +5,48 @@
margin-left: 1em;
}
}
input,
textarea {
margin-top: 0.5em;
margin-bottom: 1.5em;
width: 100%;
}
.domain-custom-box {
border-radius: 3px;
height: 1.5em;
width: 100%;
margin: 1rem;
display: block;
.domain {
border: solid 1px #eee;
padding: 0.5rem;
float: left;
width: 40%;
background: #ddd;
text-align: right;
}
.inline-input {
border: solid 1px #ddd !important;
padding: 0.5rem;
display: inline-block;
background: #fff;
margin: 0;
float: left;
width: 49%;
}
}
.permissions-modification {
input {
height: 1.5rem;
width: 1.5rem;
margin-right: 1rem;
}
label {
float: right;
width: 90%;
}
}

View File

@ -17,7 +17,12 @@ export class AdvancedConfigComponent implements OnInit {
public poll?: Poll;
@Input()
public form: FormGroup;
domain_url: string;
constructor(public pollService: PollService) {}
ngOnInit(): void {}
ngOnInit(): void {
this.domain_url = 'https://' + new URL(window.location.href).hostname + '/';
this.form.patchValue({ custom_url: this.pollService.makeSlug(this.pollService.form) });
}
}

View File

@ -132,8 +132,8 @@
"custom_label": "Saisissez le lien de votre sondage",
"custom_desc": "Modifier le lien de votre sondage le rend plus facilement accessible à tous le monde. Il est recommandé de le protéger par mot de passe.",
"password_title": "Protéger par mot de passe",
"password_label": "Cette étape est facultative.",
"password_label_repeat": "Cette étape est facultative.",
"password_label": "Mot de passe",
"password_label_repeat": "Confirmer mot de passe",
"password_validation_ok": "Vos mots de passe sont identiques",
"password_display_without": "Les résultats sont visibles sans mot de passe",
"allowances_title": "Permissions",