diff --git a/src/app/config/mocks/mockmypolls.ts b/src/app/config/mocks/mockmypolls.ts
index 2fb32db2..4bf1f435 100644
--- a/src/app/config/mocks/mockmypolls.ts
+++ b/src/app/config/mocks/mockmypolls.ts
@@ -1,7 +1,7 @@
export const mockMyPolls =
[{
- "id": 1,
- "title": "blehehehe heh hehhe e",
+ "id": 1000001,
+ "title": "blehehehe heh hehhe e test1",
"customUrl": null,
"description": "maaaaaaaaaaah",
"creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"},
@@ -19,5 +19,25 @@ export const mockMyPolls =
"choices": {},
"comments": {},
"defaultExpiracyDaysFromNow": 60
+ }, {
+ "id": 1000002,
+ "title": "bleh z zr erth tuyjikioy yylil test2",
+ "customUrl": null,
+ "description": "maaaaaaaaaaah 2",
+ "creationDate": {"date": "2020-01-20 14:21:16.270157", "timezone_type": 3, "timezone": "Europe/Paris"},
+ "expiracyDate": {"date": "2020-01-20 14:21:16.270178", "timezone_type": 3, "timezone": "Europe/Paris"},
+ "owner": null,
+ "kind": "text",
+ "allowedAnswers": ["yes"],
+ "modificationPolicy": "nobody",
+ "mailOnComment": null,
+ "mailOnVote": null,
+ "hideResults": null,
+ "showResultEvenIfPasswords": null,
+ "votes": {},
+ "stacksOfVotes": {},
+ "choices": {},
+ "comments": {},
+ "defaultExpiracyDaysFromNow": 60
}]
;
diff --git a/src/app/pages/answers/answers.component.html b/src/app/pages/answers/answers.component.html
index fb8ddce4..78896640 100644
--- a/src/app/pages/answers/answers.component.html
+++ b/src/app/pages/answers/answers.component.html
@@ -63,6 +63,7 @@
[(ngModel)]="answer.text"
(keyup.enter)="addAnswer()"
(keyup)="navigateOrDelete($event,i)"
+ required='required'
placeholder="réponse"
>
diff --git a/src/app/pages/answers/answers.component.scss b/src/app/pages/answers/answers.component.scss
index 66f174a6..e69de29b 100644
--- a/src/app/pages/answers/answers.component.scss
+++ b/src/app/pages/answers/answers.component.scss
@@ -1,8 +0,0 @@
-:host {
- .img-thumbnail {
- width: 5em;
- height: 5em;
- margin: 1ch 0;
- display: inline-block;
- }
-}
diff --git a/src/app/pages/answers/answers.component.ts b/src/app/pages/answers/answers.component.ts
index ed4a4b62..ab769f02 100644
--- a/src/app/pages/answers/answers.component.ts
+++ b/src/app/pages/answers/answers.component.ts
@@ -1,4 +1,4 @@
-import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnInit} from '@angular/core';
+import {AfterViewInit, ChangeDetectorRef, Component, Inject, OnChanges, OnInit} from '@angular/core';
import {BaseComponent} from '../base-page/base.component';
import {ConfigService} from '../../services/config.service';
@@ -9,7 +9,9 @@ import {DOCUMENT} from '@angular/common';
templateUrl: './answers.component.html',
styleUrls: ['./answers.component.scss']
})
-export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit {
+export class AnswersComponent extends BaseComponent implements OnInit, AfterViewInit, OnChanges {
+
+ private allAnswersAreValid = false;
private answerList = [];
private currentHeader: any = "";
@@ -26,8 +28,24 @@ export class AnswersComponent extends BaseComponent implements OnInit, AfterView
ngOnInit() {
}
+ ngOnChanges() {
+
+ this.checkValidAnswers();
+ }
+
+ checkValidAnswers() {
+ this.allAnswersAreValid = true;
+ this.config.answers.forEach(answer => {
+ if (!answer.text.length) {
+ this.allAnswersAreValid = false;
+ return;
+ }
+ });
+ }
+
ngAfterViewInit() {
- this.focusOnAnswer(0)
+ this.focusOnAnswer(0);
+ this.checkValidAnswers();
}
trackFunction(index: number, item: any): number {
diff --git a/src/app/pages/home/home.component.html b/src/app/pages/home/home.component.html
index 9a0de354..3a9d7523 100644
--- a/src/app/pages/home/home.component.html
+++ b/src/app/pages/home/home.component.html
@@ -1,32 +1,32 @@
-
- {{config.description}} -
-