From 0c378af406873850d79a355a69ed9597d6f0bc04 Mon Sep 17 00:00:00 2001 From: Claude Brisson Date: Fri, 26 Jan 2024 09:07:06 +0100 Subject: [PATCH] Add export of json file --- .../src/main/webapp/WEB-INF/translations/fr | 5 +++++ .../main/webapp/js/tour-information.inc.js | 22 +++++++++++++++++++ .../src/main/webapp/tour-information.inc.html | 19 ++++++++++++++++ .../src/main/webapp/tour-standings.inc.html | 14 +++++++----- 4 files changed, 54 insertions(+), 6 deletions(-) diff --git a/view-webapp/src/main/webapp/WEB-INF/translations/fr b/view-webapp/src/main/webapp/WEB-INF/translations/fr index f93338e..8920f38 100644 --- a/view-webapp/src/main/webapp/WEB-INF/translations/fr +++ b/view-webapp/src/main/webapp/WEB-INF/translations/fr @@ -20,6 +20,7 @@ Canadian byo-yomi Byo-yomi canadien Cancel Annuler Change Mettre à jour Chinese rules Règles chinoises +Choose format Choix du format Close Fermer Club Club Compile from the sources Compiler depuis les sources  @@ -33,6 +34,7 @@ Download the standalone web interface module which suits your need, then follow Edit Éditer Enter the magic word Entrer le mot magique Export Exporter +Export tournament Exporter le tournoi Family name Nom de famille First name Prénom Fischer timing Cadence Fisher @@ -73,6 +75,8 @@ Pair-go tournament Tournoi de pair-go Pairing Appariement Pairings for round Appariement pour la ronde Participation Participation +Publish Publier +Publish standings Publier le classement Rank Niveau Rating Classement Register Inscrire @@ -80,6 +84,7 @@ Registration Inscriptions Rengo with 2 players teams Rengo par équipes de 2 Rengo with 3 players team Rengo par équipes de 3 Required field Champs requis +Reset Mac Mahon groups Réinitialiser les groupes Mac Mahon Results Résultats Results for round Résultats pour la ronde Round-robin Toutes rondes 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 0997828..c8b2d89 100644 --- a/view-webapp/src/main/webapp/js/tour-information.inc.js +++ b/view-webapp/src/main/webapp/js/tour-information.inc.js @@ -100,6 +100,28 @@ onLoad(() => { }); $('#export').on('click', e => { + modal('export-modal'); + }); + + $('#export-pairgoth').on('click', e => { + close_modal(); + let form = $('#tournament-infos')[0]; + let shortName = form.val('shortName'); + let hdrs = headers(); + hdrs['Accept'] = 'application/json'; + fetch(`${base}tour/${tour_id}`, { + headers: hdrs + }).then(resp => { + if (resp.ok) return resp.text() + else throw "export error" + }).then(txt => { + let blob = new Blob(['\uFEFF', txt.trim()], {type: 'application/json;charset=utf-8'}); + downloadFile(blob, `${shortName}.tour`); + }).catch(err => showError(err)); + }); + + $('#export-opengotha').on('click', e => { + close_modal(); let form = $('#tournament-infos')[0]; let shortName = form.val('shortName'); let hdrs = headers(); diff --git a/view-webapp/src/main/webapp/tour-information.inc.html b/view-webapp/src/main/webapp/tour-information.inc.html index 9852b19..fde016c 100644 --- a/view-webapp/src/main/webapp/tour-information.inc.html +++ b/view-webapp/src/main/webapp/tour-information.inc.html @@ -235,3 +235,22 @@ + diff --git a/view-webapp/src/main/webapp/tour-standings.inc.html b/view-webapp/src/main/webapp/tour-standings.inc.html index 0871ad5..0ef93f0 100644 --- a/view-webapp/src/main/webapp/tour-standings.inc.html +++ b/view-webapp/src/main/webapp/tour-standings.inc.html @@ -94,17 +94,19 @@