From 9462c3936151ef61023a5804f9b25f8e59eeda5b Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 26 Apr 2020 15:06:44 +0200 Subject: [PATCH 1/4] fix(check-field) : checkfield function have to check if label of candidate is not an empty string --- src/components/views/CreateElection.jsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index 63890a1..bb702e9 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -264,14 +264,13 @@ class CreateElection extends Component { checkFields() { const { candidates, title } = this.state; - if (!candidates) { return { ok: false, msg: AT_LEAST_2_CANDIDATES_ERROR }; } let numCandidates = 0; candidates.forEach(c => { - if (c !== "") numCandidates += 1; + if (c.label !== "") numCandidates += 1; }); if (numCandidates < 2) { return { ok: false, msg: AT_LEAST_2_CANDIDATES_ERROR }; From 89a00a2f39003207fad2d305d2a89de9b2775b56 Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 26 Apr 2020 15:10:41 +0200 Subject: [PATCH 2/4] fix(check-field) : improve design/UI --- src/components/views/CreateElection.jsx | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index bb702e9..94b46bd 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -700,16 +700,16 @@ class CreateElection extends Component {
{t("Confirm your vote")}
-
+
{t("Question of the election")}
-
+
{title}
-
+
{t("Candidates/Proposals")}
-
+
    {candidates.map((candidate, i) => { if (candidate.label !== "") { @@ -724,10 +724,10 @@ class CreateElection extends Component { })}
-
+
{t("Dates")}
-
+
{t("The election will take place from")}{" "} {start.toLocaleDateString()}, {t("at")}{" "} @@ -739,10 +739,10 @@ class CreateElection extends Component { {finish.toLocaleTimeString()}
-
+
{t("Grades")}
-
+
{grades.map((mention, i) => { return i < numGrades ? ( -
+
{t("Voters' list")}
-
+
{electorEmails.length > 0 ? ( electorEmails.join(", ") ) : ( From 8b66c7c9b03f4974c571adfc55410dd43ae3842b Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 26 Apr 2020 15:11:13 +0200 Subject: [PATCH 3/4] fix(check-field) : prettier format --- src/components/views/CreateElection.jsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index 94b46bd..800938b 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -229,7 +229,7 @@ class CreateElection extends Component { editCandidateLabel = (event, index) => { let candidates = this.state.candidates; candidates[index].label = event.currentTarget.value; - candidates.map((candidate) => { + candidates.map(candidate => { return candidate.label; }); this.setState({ @@ -469,10 +469,10 @@ class CreateElection extends Component { - + - + - +
-
{t("Confirm your vote")}
+
+ {t("Confirm your vote")} +
{t("Question of the election")}
-
- {title} -
+
{title}
{t("Candidates/Proposals")}
From bff827fc55e797c5fdfec4268291937abcd3eb7b Mon Sep 17 00:00:00 2001 From: Clement G Date: Sun, 26 Apr 2020 15:24:02 +0200 Subject: [PATCH 4/4] fix(check-field) : update tooltip text on helpButton --- public/locale/i18n/de/resource.json | 1 + public/locale/i18n/en/resource.json | 1 + public/locale/i18n/es/resource.json | 1 + public/locale/i18n/fr/resource.json | 1 + public/locale/i18n/ru/resource.json | 1 + src/components/views/CreateElection.jsx | 2 +- 6 files changed, 6 insertions(+), 1 deletion(-) diff --git a/public/locale/i18n/de/resource.json b/public/locale/i18n/de/resource.json index 72699b8..78c208f 100644 --- a/public/locale/i18n/de/resource.json +++ b/public/locale/i18n/de/resource.json @@ -11,6 +11,7 @@ "Are you sure to delete": "Sind Sie sich sicher, dass Sie dies löschen möchten?", "the row": "die Zeile", "Write here your question or introduce simple your election (250 characters max.)": "Schreiben Sie hier Ihre Frage oder erklären Sie kurz ihre Wahl (bis 250 Zeichen)", + "Enter the name of your candidate or proposal here (250 characters max.)": "Geben Sie hier den Namen Ihres Kandidaten oder Antrags ein (max. 250 Zeichen)", "Please add at least 2 candidates.": "Bitte geben Sie mindestens zwei Kandidaten vor. ", "Question of the election": "Zur Wahl stehende Frage", "Write here the question of your election": "Schreiben Sie hier die zur Wahl stehenden Frage", diff --git a/public/locale/i18n/en/resource.json b/public/locale/i18n/en/resource.json index 0ba295a..8be6f24 100644 --- a/public/locale/i18n/en/resource.json +++ b/public/locale/i18n/en/resource.json @@ -11,6 +11,7 @@ "Are you sure to delete": "Are you sure to delete", "the row": "the row", "Write here your question or introduce simple your election (250 characters max.)": "Write here your question or introduce simple your election (250 characters max.)", + "Enter the name of your candidate or proposal here (250 characters max.)":"Enter the name of your candidate or proposal here (250 characters max.)", "Please add at least 2 candidates.": "Please add at least 2 candidates.", "Question of the election": "Question of the election", "Write here the question of your election": "Write here the question of your election", diff --git a/public/locale/i18n/es/resource.json b/public/locale/i18n/es/resource.json index a40cdf6..1176d17 100644 --- a/public/locale/i18n/es/resource.json +++ b/public/locale/i18n/es/resource.json @@ -11,6 +11,7 @@ "Are you sure to delete": "Estás seguro de querer borrar", "the row": "la fila", "Write here your question or introduce simple your election (250 characters max.)": "Escriba aquí su pregunta o introduzca simplemente su elección (250 caracteres máx.)", + "Enter the name of your candidate or proposal here (250 characters max.)": "Escriba aquí el nombre de su candidato o propuesta (250 caracteres como máximo)", "Please add at least 2 candidates.": "Por favor, añada al menos dos canidatos(as).", "Question of the election": "Pregunta de su elección", "Write here the question of your election": "Escriba aquí la pregunta de su elección", diff --git a/public/locale/i18n/fr/resource.json b/public/locale/i18n/fr/resource.json index 8802549..f2c0857 100644 --- a/public/locale/i18n/fr/resource.json +++ b/public/locale/i18n/fr/resource.json @@ -11,6 +11,7 @@ "Are you sure to delete": "Êtes-vous sûr(e) de supprimer", "the row": "la ligne", "Write here your question or introduce simple your election (250 characters max.)": "Décrire ici votre question ou introduire simplement votre élection (250 caractères max.)", + "Enter the name of your candidate or proposal here (250 characters max.)": "Saisissez ici le nom de votre candidat ou de votre proposition (250 caractères max.)", "Please add at least 2 candidates.": "Merci d'ajouter au moins 2 candidats.", "Question of the election": "Question de votre élection", "Write here the question of your election": "Ecrire ici la question de votre élection", diff --git a/public/locale/i18n/ru/resource.json b/public/locale/i18n/ru/resource.json index 15de841..7a0ccca 100644 --- a/public/locale/i18n/ru/resource.json +++ b/public/locale/i18n/ru/resource.json @@ -11,6 +11,7 @@ "Are you sure to delete": "Вы уверены в удалении", "the row": "ряд", "Write here your question or introduce simple your election (250 characters max.)": "Напишите свой вопрос или опишите голосование (250 символов максимум.)", + "Enter the name of your candidate or proposal here (250 characters max.)": "Введите имя вашего кандидата или предложение здесь (не более 250 символов).", "Please add at least 2 candidates.": "Пожалуйста добавьте как минимум 2 кандидатов", "Question of the election": "Суть голосования", "Write here the question of your election": "Напишите вопрос вашего голосования", diff --git a/src/components/views/CreateElection.jsx b/src/components/views/CreateElection.jsx index 800938b..f7ed147 100644 --- a/src/components/views/CreateElection.jsx +++ b/src/components/views/CreateElection.jsx @@ -138,7 +138,7 @@ const SortableCandidate = sortableElement( {t( - "Write here your question or introduce simple your election (250 characters max.)" + "Enter the name of your candidate or proposal here (250 characters max.)" )}