From 37160961d54a21c883416beac984eb420ac13d4b Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Wed, 6 Mar 2024 20:28:51 +0100 Subject: [PATCH] Delete button for tournaments --- view-webapp/src/main/webapp/WEB-INF/translations/fr | 1 + .../src/main/webapp/js/tour-information.inc.js | 13 ++++++++++++- .../src/main/webapp/tour-information.inc.html | 4 ++++ 3 files changed, 17 insertions(+), 1 deletion(-) diff --git a/view-webapp/src/main/webapp/WEB-INF/translations/fr b/view-webapp/src/main/webapp/WEB-INF/translations/fr index 370329b..530abfe 100644 --- a/view-webapp/src/main/webapp/WEB-INF/translations/fr +++ b/view-webapp/src/main/webapp/WEB-INF/translations/fr @@ -31,6 +31,7 @@ Create Créer Crit Crit Ctr Pays Dates Dates +Delete Supprimer Download Télécharger Download the standalone web interface module which suits your need, then follow Télécharger le module d’interface web qui correspond à vos besoins, puis suivez Edit Éditer diff --git a/view-webapp/src/main/webapp/js/tour-information.inc.js b/view-webapp/src/main/webapp/js/tour-information.inc.js index 35c8318..439ad45 100644 --- a/view-webapp/src/main/webapp/js/tour-information.inc.js +++ b/view-webapp/src/main/webapp/js/tour-information.inc.js @@ -10,7 +10,7 @@ onLoad(() => { if ($('#tournament-infos').hasClass('edit') && typeof(tour_id) !== 'undefined') { $('#tournament-infos').removeClass('edit') } else { - document.location.href = '/index'; + window.location.href = '/index'; } return false; }); @@ -107,6 +107,17 @@ onLoad(() => { modal('export-modal'); }); + $('#delete').on('click', e => { + if (confirm('Supprimer ce tournoi ?')) { + api.deleteJson(`tour/${tour_id}`, {}) + .then(resp => { + if (resp !== 'error') { + window.location.href = '/index'; + } + }) + } + }); + $('#export-pairgoth').on('click', e => { close_modal(); let form = $('#tournament-infos')[0]; diff --git a/view-webapp/src/main/webapp/tour-information.inc.html b/view-webapp/src/main/webapp/tour-information.inc.html index f98cbe5..49561c4 100644 --- a/view-webapp/src/main/webapp/tour-information.inc.html +++ b/view-webapp/src/main/webapp/tour-information.inc.html @@ -225,6 +225,10 @@ Edit + #end