autofill creation var in env

This commit is contained in:
Tykayn 2021-11-12 12:09:48 +01:00 committed by tykayn
parent 52ff89f1f5
commit 3dc7555747
7 changed files with 39 additions and 32 deletions

View File

@ -64,8 +64,9 @@ export class PollService implements Resolve<Poll> {
private fb: FormBuilder
) {
this.createFormGroup();
if (environment.autofill) {
if (environment.autofill_creation) {
this.setDemoValues();
this.toastService.display('auto fill de création fait');
} else {
this.calendar = [new Date()];
}
@ -381,7 +382,7 @@ export class PollService implements Resolve<Poll> {
}
askInitFormDefault(): void {
this.initFormDefault(false);
this.initFormDefault(environment.autofill_creation);
this.toastService.display('formulaire réinitialisé');
}

View File

@ -46,7 +46,7 @@ export class StorageService {
public choices: Choice[] = [];
constructor(public dateUtilities: DateUtilitiesService, private toastService: ToastService) {
if (environment.autofill) {
if (environment.autofill_participation) {
this.toastService.display('autofill des sondages utilisateur');
this.userPolls.push(new Poll(new Owner(), 'Démo: Anniversaire de tonton Patrick', 'aujourdhui-ou-demain'));
this.userPolls.push(new Poll(new Owner(), 'Démo: Atelier cuisine du quartier', 'aujourdhui-ou-demain'));
@ -71,7 +71,7 @@ export class StorageService {
this.vote_stack = new Stack();
for (const choice of choices_list) {
if (environment.autofill) {
if (environment.autofill_participation) {
console.log('autofill au hasard des votes à ce sondage');
this.toastService.display('autofill au hasard des votes à ce sondage');
const defaultvalue = Math.random() > 0.75 ? 'yes' : '';

View File

@ -54,12 +54,15 @@
</button>
</div>
<div class="column">
<app-errors-list [form]="pollService.form"></app-errors-list>
<button class="btn is-primary" (click)="createPoll()">
<i class="fa fa-save"></i>
Enregistrer le sondage
</button>
<button class="btn is-primary" (click)="createPoll()" [disabled]="!pollService.form.valid">
<i class="fa fa-save"></i>
Enregistrer le sondage
</button>
</div>
</div>
<app-errors-list [form]="pollService.form"></app-errors-list>
</div>

View File

@ -7,44 +7,32 @@
</h2>
<div class="columns">
<div class="column">
<label for="title">Titre</label>
<div>
<label for="title">Titre</label>
</div>
<input
class="input-lg"
#title
[placeholder]="'creation.choose_title_placeholder' | translate"
formControlName="title"
aria-placeholder="Quel resto ce soir ?"
placeholder="Quel resto ce soir ?"
(keyup)="pollService.updateSlug()"
(blur)="pollService.updateSlug()"
id="title"
autofocus="autofocus"
required
/>
</div>
<!-- (keyup)="pollService.updateSlug()"-->
<!-- (blur)="pollService.updateSlug()"-->
<div class="column is-narrow">
<button
mat-button
*ngIf="title.value"
matSuffix
mat-icon-button
aria-label="Clear"
(click)="title.value = ''"
>
<i class="fa fa-close"></i>
</button>
</div>
</div>
</section>
<div class="poll-description">
<div class="columns">
<div class="column">
<label for="descr">Description (optionnel)</label>
<div class="rich-text-toggle">
<label for="richTextMode">mode de saisie avancée</label>
<!-- <div class="rich-text-toggle">-->
<!-- <label for="richTextMode">mode de saisie avancée</label>-->
<mat-checkbox formControlName="richTextMode" id="richTextMode"></mat-checkbox>
</div>
<!-- <mat-checkbox formControlName="richTextMode" id="richTextMode"></mat-checkbox>-->
<!-- </div>-->
<div class="rich-toolbar" *ngIf="pollService.form.value.richTextMode">
richTextMode activé
</div>
@ -77,7 +65,6 @@
</div>
</div>
</div>
slug: {{ pollService.form.value.custom_url }}
</form>
<div class="columns">
<div class="column"></div>

View File

@ -16,7 +16,8 @@ export const environment = {
production: true,
display_routes: true,
showDemoWarning: true,
autofill: false,
autofill_creation: true,
autofill_participation: true,
autoSendNewPoll: false,
interval_days_default: 7,
expiresDaysDelay: 60,

View File

@ -10,10 +10,11 @@ endpoints.baseHref = apiV1.baseHref;
export const environment = {
frontDomain: 'http://127.0.0.1:4200',
production: false,
display_routes: true,
autofill: true,
display_routes: false, // demo paths to test polls
autofill_creation: true,
autofill_participation: true,
// autofill: false,
showDemoWarning: true,
showDemoWarning: false,
autoSendNewPoll: false,
interval_days_default: 7,
expiresDaysDelay: 60,

View File

@ -1,5 +1,14 @@
@charset "UTF-8";
app-step-one,
app-step-two,
app-step-three,
app-step-four,
app-step-five {
padding: 2em 1em;
display: block;
}
input,
select,
textarea {
@ -244,15 +253,19 @@ mat-checkbox {
.pi-chevron-left:after {
content: '<';
}
.pi-chevron-right:after {
content: '>';
}
.p-datepicker-month {
margin-right: 1em;
}
.p-datepicker-weeknumber span {
border-right: 1px solid $legend_color;
}
.p-datepicker-today span {
font-weight: bold;
border: solid 1px $legend_color;
@ -262,6 +275,7 @@ mat-checkbox {
padding: 1em;
width: 3.5em;
transition: all ease 0.5s;
&:hover {
background: mix($white, $legend_color);
color: $white;