Permit to modify contestants categories
This commit is contained in:
@@ -15,6 +15,14 @@
|
||||
= form.label :email
|
||||
.form-text
|
||||
= t("activerecord.attributes.contestant.email_description")
|
||||
- if @contest.categories
|
||||
.row.mt-4
|
||||
.col
|
||||
- @contest.categories.each do |category|
|
||||
.form-check.form-switch
|
||||
= form.check_box "category_#{category.id}".to_sym, class: "form-check-input", checked: @contestant.categories.where(id: category.id).any?
|
||||
= form.label category.name
|
||||
|
||||
.row.mt-4
|
||||
.col
|
||||
- if method == :patch
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user