-
- Type de sondage
-
-
{{ 'dates.title' | translate }}
-
-
-
-
Version complète du formulaire
Nombre de jours avant expiration
@@ -188,12 +211,22 @@
La réponse « peut-être » sera disponible
-
diff --git a/src/app/features/administration/form/form.component.scss b/src/app/features/administration/form/form.component.scss
index 05b9c0fa..7c8963bc 100644
--- a/src/app/features/administration/form/form.component.scss
+++ b/src/app/features/administration/form/form.component.scss
@@ -17,7 +17,5 @@
padding-left: 1em;
}
.fa {
- margin-right: 1em;
- color: $primary_color;
}
}
diff --git a/src/app/features/administration/form/form.component.ts b/src/app/features/administration/form/form.component.ts
index da288898..860e6c41 100644
--- a/src/app/features/administration/form/form.component.ts
+++ b/src/app/features/administration/form/form.component.ts
@@ -4,6 +4,7 @@ import { FormArray, FormBuilder, FormGroup, Validators } from '@angular/forms';
import { UuidService } from '../../../core/services/uuid.service';
import { ApiService } from '../../../core/services/api.service';
import { ToastService } from '../../../core/services/toast.service';
+import { PollService } from '../../../core/services/poll.service';
@Component({
selector: 'app-admin-form',
@@ -15,14 +16,14 @@ export class FormComponent implements OnInit {
public poll?: Poll;
public form: FormGroup;
- public longFormVersionEnabled = true;
-
public urlPrefix: string = window.location.origin + '/participation/';
+ public advancedDisplayEnabled = false;
constructor(
private fb: FormBuilder,
private uuidService: UuidService,
private toastService: ToastService,
+ private pollService: PollService,
private apiService: ApiService
) {}
@@ -33,8 +34,9 @@ export class FormComponent implements OnInit {
public createPoll(): void {
if (this.form.valid && this.form.valid) {
console.log('Le sondage est correctement rempli, prêt à enregistrer.');
+ let newpoll = this.pollService.newPollFromForm(this.form);
// TODO : save the poll
- this.apiService.createPoll(this.poll);
+ this.apiService.createPoll(newpoll);
}
}
@@ -47,13 +49,18 @@ export class FormComponent implements OnInit {
return this.form.get('choices') as FormArray;
}
- addChoice() {
- this.choices.push(
- this.fb.group({
- label: this.fb.control('', [Validators.required]),
- imageUrl: ['', [Validators.required]],
- })
- );
+ addChoice(optionalLabel: string = '') {
+ let newControlGroup = this.fb.group({
+ label: this.fb.control('', [Validators.required]),
+ imageUrl: ['', [Validators.required]],
+ });
+
+ if (optionalLabel) {
+ newControlGroup.patchValue({
+ label: optionalLabel,
+ });
+ }
+ this.choices.push(newControlGroup);
}
deleteChoiceField(index: number) {
@@ -84,9 +91,9 @@ export class FormComponent implements OnInit {
});
console.log('this.form ', this.form);
- this.addChoice();
- this.addChoice();
- this.addChoice();
+ this.addChoice('orange');
+ this.addChoice('raisin');
+ this.addChoice('abricot');
this.form.patchValue({
title: 'mon titre',
diff --git a/src/app/shared/components/selectors/theme-selector/theme-selector.component.html b/src/app/shared/components/selectors/theme-selector/theme-selector.component.html
index d6619bb3..e8a55d39 100644
--- a/src/app/shared/components/selectors/theme-selector/theme-selector.component.html
+++ b/src/app/shared/components/selectors/theme-selector/theme-selector.component.html
@@ -1,7 +1,4 @@