diff --git a/main.lqa b/main.lqa new file mode 100644 index 00000000..129f393a --- /dev/null +++ b/main.lqa @@ -0,0 +1,4 @@ + + + + diff --git a/src/app/core/components/footer/footer.component.scss b/src/app/core/components/footer/footer.component.scss index e69de29b..d67d5c66 100644 --- a/src/app/core/components/footer/footer.component.scss +++ b/src/app/core/components/footer/footer.component.scss @@ -0,0 +1,4 @@ +.app-logo { + max-width: 5em; + max-height: 5em; +} diff --git a/src/app/core/components/header/header.component.html b/src/app/core/components/header/header.component.html index d503fa90..47591274 100644 --- a/src/app/core/components/header/header.component.html +++ b/src/app/core/components/header/header.component.html @@ -3,7 +3,7 @@ diff --git a/src/app/core/models/poll.model.ts b/src/app/core/models/poll.model.ts index a1916fb1..288822ab 100644 --- a/src/app/core/models/poll.model.ts +++ b/src/app/core/models/poll.model.ts @@ -7,9 +7,9 @@ import { User } from './user.model'; export class Poll { constructor( - public owner: User, - public slug: string, - public title: string, + public owner: User = new User(), + public slug: string = 'default-slug', + public title: string = 'default title', public description?: string, public configuration: PollConfiguration = new PollConfiguration(), public comments: Comment[] = [], diff --git a/src/app/core/models/user.model.ts b/src/app/core/models/user.model.ts index ce98dd67..a8096ac3 100644 --- a/src/app/core/models/user.model.ts +++ b/src/app/core/models/user.model.ts @@ -3,8 +3,8 @@ import { Poll } from './poll.model'; export class User { constructor( - public pseudo: string, - public email: string, + public pseudo: string = 'pseudo', + public email: string = 'example@example.com', public polls: Poll[] = [], public role?: UserRole, public token?: string diff --git a/src/app/core/services/poll.service.ts b/src/app/core/services/poll.service.ts index 13ded9c7..c9ccf6af 100644 --- a/src/app/core/services/poll.service.ts +++ b/src/app/core/services/poll.service.ts @@ -10,6 +10,7 @@ import { ApiService } from './api.service'; import { ToastService } from './toast.service'; import { UserService } from './user.service'; import { UuidService } from './uuid.service'; +import { Form } from '@angular/forms'; @Injectable({ providedIn: 'root', @@ -124,4 +125,13 @@ export class PollService implements Resolve { return list; } + + newPollFromForm(form: any) { + const newpoll = new Poll( + this.userService.getCurrentUser(), + this.uuidService.getUUID(), + form.controls.title.value + ); + return newpoll; + } } diff --git a/src/app/features/administration/form/form.component.html b/src/app/features/administration/form/form.component.html index f189ec5d..87fec962 100644 --- a/src/app/features/administration/form/form.component.html +++ b/src/app/features/administration/form/form.component.html @@ -2,9 +2,7 @@

{{ 'creation.title' | translate }}

- - {{ 'creation.want' | translate }} - + - + -
-
- - - - - -
-
+ + {{ 'creation.choose_title' | translate }} - -
+ +
+

Choix de réponse

+ + + + + + + + + + + +
+
+
{{ i * 1 + 1 }})
+
+ + +
+ + +
+
+ +
+
+
+
+
+
+

-

- 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 - - - version longue du formulaire activée - +
+
+ + version longue du formulaire activée + +
+
+ +
+
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 @@
-
-

Theme

-