Permit to modify contestants categories
All checks were successful
CI / scan_ruby (push) Successful in 20s
CI / scan_js (push) Successful in 13s
CI / lint (push) Successful in 13s
CI / test (push) Successful in 34s

This commit is contained in:
sto
2025-07-16 10:22:47 +02:00
parent 657c5ac47b
commit b13ef30807
3 changed files with 26 additions and 5 deletions

View File

@@ -54,13 +54,13 @@ javascript:
option value=category.id
= category.name
javascript:
const select = document.getElementById('categories');
const urlParams = new URLSearchParams(window.location.search);
const selectedCategory = urlParams.get('category');
Array.from(select.children).forEach((option) => {
categorySelectEl = document.getElementById('categories');
urlParams = new URLSearchParams(window.location.search);
selectedCategory = urlParams.get('category');
Array.from(categorySelectEl.children).forEach((option) => {
if (option.value == selectedCategory) option.selected = true;
});
select.addEventListener('change', (e) => {
categorySelectEl.addEventListener('change', (e) => {
window.location.href = `#{contest_path(@contest)}?category=${e.target.value}`
})
.d-flex.flex-column style="overflow-y: auto"