Allow to delete contests
This commit is contained in:
18
app/views/application/_modal.html.slim
Normal file
18
app/views/application/_modal.html.slim
Normal file
@@ -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";
|
||||
})
|
||||
@@ -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');
|
||||
})
|
||||
@@ -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"
|
||||
= 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"
|
||||
Reference in New Issue
Block a user