diff --git a/app/views/application/_modal.html.slim b/app/views/application/_modal.html.slim
new file mode 100644
index 0000000..cba7016
--- /dev/null
+++ b/app/views/application/_modal.html.slim
@@ -0,0 +1,18 @@
+.modal id="#{modal_id}" tabindex=-1 style="position:fixed; background-color: rgba(0, 0, 0, 0.5)"
+ .modal-dialog.modal-dialog-centered
+ .modal-content style="background-color: white;width: 100%"
+ .modal-header
+ .modal-title
+ = modal_title
+ button.btn-close type="button" id="#{modal_id}_close"
+ .modal-body
+ = modal_text
+ .modal-footer
+ = link_to t("helpers.buttons.confirm"), path, data: { turbo_method: :delete }, class: "btn btn-danger"
+javascript:
+ document.getElementById("#{modal_id}_close").addEventListener('click', (e) => {
+ document.getElementById("#{modal_id}").style.display = "none";
+ })
+ document.getElementById("#{modal_id}_button").addEventListener('click', (e) => {
+ document.getElementById("#{modal_id}").style.display = "block";
+ })
\ No newline at end of file
diff --git a/app/views/contests/_selectors.html.slim b/app/views/contests/_selectors.html.slim
index 3665065..3f3795e 100644
--- a/app/views/contests/_selectors.html.slim
+++ b/app/views/contests/_selectors.html.slim
@@ -27,7 +27,6 @@
= t("contests.scoreboard.hide_offline")
javascript:
document.getElementById('offline').addEventListener('change', (e) => {
- console.log('changed');
if (e.target.checked) addParam('hide_offline', e.target.checked);
else removeParam('hide_offline');
})
\ No newline at end of file
diff --git a/app/views/contests/settings_general_edit.html.slim b/app/views/contests/settings_general_edit.html.slim
index 5638d76..2f40c17 100644
--- a/app/views/contests/settings_general_edit.html.slim
+++ b/app/views/contests/settings_general_edit.html.slim
@@ -31,4 +31,7 @@
.form-text = t("activerecord.attributes.contest.allow_registration_description")
.row.mt-4
.col
- = form.submit t("helpers.buttons.update"), class: "btn btn-primary"
\ No newline at end of file
+ = form.submit t("helpers.buttons.update"), class: "btn btn-primary"
+ button.btn.btn-danger.ms-3 type="button" id="contest_deletion_modal_button"
+ = t("contests.modals.destroy.button")
+ = render "modal", path: contest_path(@contest), modal_title: t("contests.modals.destroy.title", contest: @contest.name), modal_text: t("contests.modals.destroy.text", contest: @contest.name), modal_id: "contest_deletion_modal"
\ No newline at end of file
diff --git a/config/locales/en.yml b/config/locales/en.yml
index 04a3cc4..a689b68 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -202,6 +202,11 @@ en:
title: Welcome %{username}!
manage_contests: Manage my contests
new_contest: Create a new contest
+ modals:
+ destroy:
+ button: Delete contest
+ text: You are about to delete the contest %{contest} and all its related data (participants, puzzles, ...). This action is non reversible, are you sure to want to proceed?
+ title: Deletion of contest %{contest}
nav:
categories: Participant categories
categories_description: Once you add categories, you will be able to assign them to participants on their profiles, and a filter for categories will be available on the public scoreboard
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 72fbd63..3c32a78 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -173,6 +173,11 @@ fr:
title: Bienvenue %{username} !
manage_contests: Mes concours de puzzle
new_contest: Créer un nouveau concours
+ modals:
+ destroy:
+ button: Supprimer le concours
+ text: Tu t'apprête à supprimer le concours %{contest} et toutes ses données liées (participant.e.s, puzzles, ...). Cette action est définitive et non-réversible, es-tu sûr.e de vouloir procéder ?
+ title: Suppression du concours %{contest}
nav:
categories: Catégories de participant.e.s
categories_description: Après avoir ajouté des catégories, elles pourront être attributées aux participant.e.s sur leurs profils, et un filtre sera disponible sur le classement public