1234567891011121314151617181920212223242526272829 |
- import { Controller } from '@hotwired/stimulus';
- /*
- * Contrôleur Stimulus pour le formulaire JEUX.
- */
- export default class extends Controller {
- connect() {
- this.initDisabling();
- console.log("Stimulus: gestion des champs à désactiver");
-
- }
- initDisabling() {
- const checkInLibrary = document.querySelector('#library-controller input');
- checkInLibrary.addEventListener('change', () => {
- const formToDisable = Array.from(document.querySelectorAll(".only-in-library"));
- formToDisable.forEach((el) => {
- if (checkInLibrary.checked) {
- el.classList.remove("is-hidden");
- } else {
- el.classList.add("is-hidden");
- }
- });
- });
- }
- }
|