kolory kategorii i jedniklikowy wybor kategorii w modalu
This commit is contained in:
18
static/js/category_modal.js
Normal file
18
static/js/category_modal.js
Normal file
@@ -0,0 +1,18 @@
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('#categoriesModal .category-suggestion').forEach(btn => {
|
||||
btn.addEventListener('click', () => {
|
||||
const select = document.getElementById('category_id');
|
||||
if (!select) return;
|
||||
|
||||
select.value = btn.dataset.catId || '';
|
||||
const form = btn.closest('form');
|
||||
if (form) {
|
||||
if (typeof form.requestSubmit === 'function') {
|
||||
form.requestSubmit();
|
||||
} else {
|
||||
form.submit();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user