diff --git a/canapEPFL/README.md b/canapEPFL/README.md index a304ddc4587eb8958ca85adf891b831ba63c2650..0807508a84599b0cb874d736a76c9e3756a724e5 100644 --- a/canapEPFL/README.md +++ b/canapEPFL/README.md @@ -1,9 +1,9 @@ # Améliorations en cours - [x] Utiliser la nouvelle charte 2018 - [x] Adapter pour ajouter les postulations dans une DB -- [x] Ajouter une page pour voir / supprimer sa / ses postulation(s) +- [x] Ajouter une page pour voir / supprimer ses postulations - [x] Commentaires et section du code -- [ ] Editer ses postulation +- [ ] Editer ses postulations # Améliorations possibles du formulaire canap.epfl.ch diff --git a/canapEPFL/cible.php b/canapEPFL/cible.php index 55e1112e7e9e49bbe6e35428c99c0cea102c9607..da7f332cede9463c6bcf13553c8101f09d355eed 100644 --- a/canapEPFL/cible.php +++ b/canapEPFL/cible.php @@ -45,9 +45,13 @@ } } else { $_SESSION['formError'] = true; - $_SESSION['postedForm'] = $_POST; - $_SESSION['files'] = $_FILES; - include("templates/errorText.php"); + if (isset($_GET['edit'])) { + include("templates/errorTextEdit.php"); + } else { + $_SESSION['postedForm'] = $_POST; + $_SESSION['files'] = $_FILES; + include("templates/errorText.php"); + } } ?> </body> diff --git a/canapEPFL/script.js b/canapEPFL/script.js index d73ef81aa294d9b93886b84bc31911ddb37f5b19..0e90a07e6dfce4140aa9228c16ba6f24c5911ef9 100644 --- a/canapEPFL/script.js +++ b/canapEPFL/script.js @@ -58,7 +58,7 @@ function addChildren(parentId, maxItems, childTemplate, addButtonId) { var fullTemplate = childTemplate.replace(/\{(.*?)\}/g, i); $(parentId).append(fullTemplate); if (i == maxItems - 1) { - $(addButtonId).hide(750); + $(addButtonId).hide(); } } } @@ -111,7 +111,7 @@ function initButtonsAction() { } }); $('#editPost').click(function () { - document.location.href = "form.php?edit"; + document.location.href = "/form.php?edit"; }); $('#cancelEditBtn').click(function () { document.location.href = "viewpostulation.php"; @@ -128,6 +128,9 @@ function initButtonsAction() { $('#retourFormulaire').click(function () { history.go(-1); }); + $('#retourFormulaireEdit').click(function () { + document.location.href = "/form.php?edit"; + }); $('#retourAccueil').click(function () { document.location.href = "/index.php"; }); @@ -157,23 +160,23 @@ function initAddChildButtons() { + '<label for="annexe' + nextIndex + '" class="btn btn-secondary btn-sm icon-right">Choisir...</label><br>' + '<small class="error" class="form-text text-muted"></small></td></tr>'); if (nextIndex == 9) { - $('#addInputFile').hide(750); + $('#addInputFile').hide(); } } }); } function setMajState() { - $('#maj1')[0].checked ? $("#representants").show(1000) : $("#representants").hide(1000); + $('#maj1')[0].checked ? $("#representants").show() : $("#representants").hide(); } function setDejaCandState() { if ($('#dejaCand1')[0].checked) { - $("#dejaCandAnnee").hide(750); + $("#dejaCandAnnee").hide(); $("#dejaCandAnneeInput").val(""); $("#dejaCandError").html(""); } else { - $("#dejaCandAnnee").show(750); + $("#dejaCandAnnee").show(); } } @@ -265,10 +268,10 @@ function showListJob(lieu) { } function showPolyAndInfoDivs(selectedFormation) { if (selectedFormation != "menu") { - $("#all").show(1000); - selectedFormation == "informaticien" ? $("#infoOnly").show(1000) : $("#infoOnly").hide(500); - selectedFormation == "informaticien" ? $("#griTest").show(1000) : $("#griTest").hide(500); - selectedFormation == "polyMecanicien" ? $("#polyOnly").show(1000) : $("#polyOnly").hide(500); + $("#all").show(); + selectedFormation == "informaticien" ? $("#infoOnly").show() : $("#infoOnly").hide(); + selectedFormation == "informaticien" ? $("#griTest").show() : $("#griTest").hide(); + selectedFormation == "polyMecanicien" ? $("#polyOnly").show() : $("#polyOnly").hide(); } } diff --git a/canapEPFL/templates/errorTextEdit.php b/canapEPFL/templates/errorTextEdit.php index 4f93b7ec88a72daf6e9e96f6b25aa9d8db0ddd76..135aa2312e7f4cf886e0fa5354d47b42364119c4 100644 --- a/canapEPFL/templates/errorTextEdit.php +++ b/canapEPFL/templates/errorTextEdit.php @@ -5,12 +5,12 @@ if (!$_POST && !$_FILES) { echo "<li>Fichiers fournis trop volumineux ! <small>(Taille recommandée env. 2Mo)</small></li>"; } else { - echo "<li>" . $_SESSION['edit_error'] . "</li>"; + echo $_SESSION['edit_error'] != '' ? "<li>" . $_SESSION['edit_error'] . "</li>" : ''; foreach($validator->errors() as $error => $errorVal) { echo "<li>$errorVal</li>"; } } ?> </div> - <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="retourFormulaire">Retour au formulaire</button> + <button type="button" class="btn btn-primary btn-sm mt-3 mb-2" id="retourFormulaireEdit">Retour au formulaire</button> </main> \ No newline at end of file